Skip to Main Content

get the property value from css

tretonis-JavaNetMar 21 2016 — edited Mar 22 2016

How to get the node of  "-fx-graphic"  ?

Thank's

.my css

.my-button_{

    -fx-skin: "com.sun.javafx.scene.control.skin.ButtonSkin";

    -fx-background-color: -fx-shadow-highlight-color, -fx-outer-border, -fx-inner-border, -fx-body-color;

    -fx-background-insets: 0 0 -1 0, 0, 1, 2;

    -fx-background-radius: 5, 5, 4, 3;

    -fx-padding: 0.166667em 0.833333em 0.25em 0.833333em; /* 2 10 3 10 */

    -fx-text-fill: -fx-text-base-color;

    -fx-alignment: CENTER;

    -fx-content-display: LEFT;

   

    -fx-graphic: url('images/vector-combine.png'); 

}

java code

Region node = (Region)restore.lookup(".my-button");

   

Object o = node.getCssMetaData().stream()

            .filter(p -> p.getProperty().equals("-fx-graphic") )

            .findFirst().get();

         

if(o != null ) {

    CssMetaData labeled = ((CssMetaData)o);

    labeled.getStyleableProperty( ??? );  // <---------- here is my question

}

Comments
Post Details
Added on Mar 21 2016
2 comments
1,007 views