简单的问题,但我在任何地方都找不到答案(我想我不知道到底要寻找什么......)。我怎样才能防止我的工具提示显示一个丑陋的正方形和场景的背景图像作为背景,如 this picture ?!
这是我的 CSS,我相信按钮等一些选项会影响工具提示......就像它们在代码的另一部分影响我的 Datepickers 一样。我如何管理它们才不会产生这种附带效应?简单地为特定对象(例如 DatePicker 或 Tooltip)定义 CSS 是否可以解决问题?
我正在使用 JDK 8u11,MAC OS Mavericks。
.root {
-fx-background-image: url("media/background.jpg");
}
.button {
-fx-background-color:
linear-gradient(#686868 0%, #232723 25%, #373837 75%, #757575 100%),
linear-gradient(#020b02, #3a3a3a),
linear-gradient(#9d9e9d 0%, #6b6a6b 20%, #343534 80%, #242424 100%),
linear-gradient(#8a8a8a 0%, #6b6a6b 20%, #343534 80%, #262626 100%),
linear-gradient(#777777 0%, #606060 50%, #505250 51%, #2a2b2a 100%);
-fx-background-insets: 0,1,4,5,6;
-fx-background-radius: 9,8,5,4,3;
-fx-padding: 15 30 15 30;
-fx-font-family: "Arial Black";
-fx-font-size: 18px;
-fx-font-weight: bold;
-fx-text-fill: white;
-fx-effect: dropshadow( three-pass-box , rgba(255,255,255,0.2) , 1, 0.0 , 0 , 1);
}
.button:hover {
-fx-background-color:
linear-gradient(#757575 0%, #373837 25%, #232723 75%, #686868 100%),
linear-gradient(#3a3a3a, #020b02),
linear-gradient(#242424 0%, #343534 20%, #6b6a6b 80%, #9d9e9d 100%),
linear-gradient(#262626 0%, #343534 20%, #6b6a6b 80%, #8a8a8a 100%),
linear-gradient(#2a2b2a 0%, #505250 50%, #606060 51%, #777777 100%);
-fx-background-insets: 0,1,4,5,6;
-fx-background-radius: 9,8,5,4,3;
-fx-padding: 15 30 15 30;
-fx-font-family: "Arial Black";
-fx-font-size: 18px;
-fx-font-weight: bold;
-fx-text-fill: white;
-fx-effect: dropshadow( three-pass-box , rgba(255,255,255,0.2) , 1, 0.0 , 0 , 1);
-fx-cursor:hand;
}
.text-area *.text {
-fx-text-alignment: justify;
}
.text-area {
-fx-background-color: rgba(255,255,255,0.4);
}
.text-area .scroll-pane {
-fx-background-color: transparent;
}
.text-area .scroll-pane .viewport{
-fx-background-color: transparent;
}
.text-area .scroll-pane .content{
-fx-background-color: transparent;
}
.radio-button{
-fx-font-size: 14px;
-fx-font-family: "Arial Black";
-fx-fill: #818181;
-fx-effect: innershadow( three-pass-box , rgba(0,0,0,0.7) , 6, 0.0 , 0 , 2 );
}
最佳答案
这是 Java 8 modena.css 样式表中工具提示的标准样式。
.tooltip {
-fx-background: rgba(30,30,30);
-fx-text-fill: white;
-fx-background-color: rgba(30,30,30,0.8);
-fx-background-radius: 6px;
-fx-background-insets: 0;
-fx-padding: 0.667em 0.75em 0.667em 0.75em; /* 10px */
-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.5) , 10, 0.0 , 0 , 3 );
-fx-font-size: 0.85em;
}
您可以随意修改它。有关这样做的信息在 Oracle CSS reference guide 中和 CSS tutorial .
关于javafx - 工具提示背景(使用 JavaFX CSS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25336796/