9

JavaFXで強調表示の色を変更するにはどうすればよいですか?通常は青でグラデーションが付いていますが、緑を強調したいのですが。私は以下を試しました:

.root{
    -fx-shadow-highlight-color: #CCFF99;
}

手伝ってくれてありがとう!

4

3 に答える 3

22

caspian.css(JavaFX 2)またはmodena.css(JavaFX 8)を見てください

.root {
    /* A bright blue for highlighting/accenting objects.  For example: selected
     * text; selected items in menus, lists, trees, and tables; progress bars;
     * default buttons.
     */
    -fx-accent: #0093ff;

    /* A bright blue for the focus indicator of objects. Typically used as the
     * first color in -fx-background-color for the "focused" pseudo-class. Also
     * typically used with insets of -1.4 to provide a glowing effect.
     *
     * TODO: should this be derived from -fx-accent?
     */
    -fx-focus-color: #0093ff;
}

用途に応じて色を変えてください。

于 2013-01-02T17:42:52.083 に答える
2

UlukBiyはそれに素晴らしい方法で答えたと思います。

しかし、実際には、CSSを使用したスタイリングは-fx-focus-color:#0093ffをオーバーライドせず、オーバーラップします。-fx-focus-color:redを使用すると、デフォルトの青色と混合され、灰色のような色合いが表示されます。css属性-fx-accentには問題はありません。

于 2019-02-14T11:34:34.000 に答える
1

クラスセレクター-fx-highlight-fillでも使用できます。text-area

.text-area {
    -fx-highlight-fill: green;
}
于 2018-08-05T22:15:29.683 に答える