JavaFx - 发现了意外的令牌LPAREN

时间:2014-07-15 21:26:33

标签: java css netbeans javafx

我有一个JavaFx项目。其他所有东西似乎都是o.k,除了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 (

该项目完美编译,但我只是对如何解决这个问题感到好奇,最重要的是,如果这可能让我在将来遇到麻烦。谢谢大家。

1 个答案:

答案 0 :(得分:0)

看起来你正在使用渐变的旧语法(这不是有效的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%);