我有一个JavaFx项目。其他一切似乎都没问题,除了css,我有一些类得到错误高亮显示,例如:
.min_max_close {
-fx-padding: 0 12 0 12;
-fx-border-width: 0 0 0 0;
-dean-lightnavy: derive(navy, 100%);
-dean-navygrad: linear (0%,0%) to (100%,0%) stops (0%, -dean-lightnavy) **(**100%, navy);
-fx-background-color: linear (0%,0%) to (0%,50%) stops (0%, derive(deepskyblue, 80%)) **(**30%, deepskyblue) reflect;
-fx-effect: dropshadow(three-pass-box, gray, 32, 0.5, 0, 0);
-fx-background-image: url("../MediaTools/Ports/16/clearsearch.png");
-fx-background-repeat: no-repeat;
-fx-background-size: 16 16;
-fx-background-position: center center;
-fx-effect: dropshadow(three-pass-box, derive(gray, 50%) 32, 0.5, 0, 0);
}
.win_min {
-fx-padding: 0 12 0 12;
-fx-border-width: 0 0 0 0;
-dean-lightnavy: derive(navy, 100%);
-dean-navygrad: linear (0%,0%) to (100%,0%) stops (0%, -dean-lightnavy) **(**100%, navy);
-fx-background-color: linear (0%,0%) to (0%,50%) stops (0%, derive(deepskyblue, 80%)) **(**30%, deepskyblue) reflect;
-fx-effect: dropshadow(three-pass-box, gray, 32, 0.5, 0, 0);
-fx-background-image: url("../MediaTools/Ports/Tiny/shevron_l.png");
-fx-background-repeat: no-repeat;
-fx-background-size: 10 7;
-fx-background-position: center center;
-fx-effect: dropshadow(three-pass-box, derive(gray, 50%) 32, 0.5, 0, 0);
}
上面粗体部分会出现红色的错误高亮显示:
Unexpected token LPAREN found
----
(Alt-Enter shows hints)
在这些区域:
**(**100%, navy) -> the (
**(**30%, deepskyblue) -> the (
项目编译完美,但我只是好奇如何解决这个问题,最重要的是,如果这可能会让我在未来遇到麻烦。谢谢大家。
看起来你正在使用旧的渐变语法(这是无效的css!)请使用新的语法,如http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html
所述。你的渐变看起来像:-dean-navygrad: linear-gradient(from 0% 0% to 100% 0%, -dean-lightnavy 0%, navy 100%)
-fx-background-color: linear-gradient(from 0% 0% to 0% 50%, reflect, derive(deepskyblue, 80%) 0%, deepskyblue, 30%);