background - JavaFX2 : can not mix some "setStyle" on Pane -


description

on windows7 , jdk1.8.0_20, try display panes black border , given background color. using "setstyle" method that, following documentation http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html#region. problem code within testpane class. see below full running code :

package pane;  import javafx.application.application; import javafx.scene.scene; import javafx.scene.layout.borderpane; import javafx.scene.paint.color; import javafx.scene.text.text; import javafx.stage.stage;  public class borderpaneapp extends application {  public static void main(string[] args) {     launch(args); }  @override public void start(stage primarystage) {     primarystage.settitle("borderpane");      mainpane mainpane = new mainpane();      scene scene = new scene( mainpane, 400, 300, color.orange);      // layout     mainpane.prefheightproperty().bind(scene.heightproperty());     mainpane.prefwidthproperty().bind(scene.widthproperty());      primarystage.setscene(scene);     primarystage.show();  }   public class mainpane extends borderpane{     public testpane toppane = new testpane("top", color.lightskyblue);     public testpane leftpane = new testpane("left", color.aqua);     public testpane bottompane = new testpane("bottom", color.azure);     public testpane centerpane = new testpane("center", color.lightblue);      public mainpane(){         this.settop(this.toppane);         this.setleft(this.leftpane);         this.setcenter(this.centerpane);         this.setbottom(this.bottompane);     } }  public class testpane extends borderpane {     public testpane(string name, color color){          // first style part - start          this.setstyle("-fx-border-color: #ffffff;");         this.setstyle("-fx-border-width: 1px;");         this.setstyle("-fx-border-style: solid;");         // first style part - end          // second style part - start          this.setstyle("-fx-background-color: " + color.tostring().replace("0x", "#") + ";");         // second style part - end          this.setcenter(new text(name));     } } } 

after tries, can not mix code :

        // first style part - start          this.setstyle("-fx-border-color: #ffffff;");         this.setstyle("-fx-border-width: 1px;");         this.setstyle("-fx-border-style: solid;");         // first style part - end 

with 1 :

        // second style part - start          this.setstyle("-fx-background-color: " + color.tostring().replace("0x", "#") + ";");         // second style part - end 

the last 1 seems take on first , not display it. first picture shows border line sets before background , second shows background sets before border line.

enter image description here enter image description here

question

how display both style together? cheers,

jakez

setstyle() setter method, not append..

you want combine styles 1 string:

setstyle("-fx-border-color: #ffffff;-fx-border-width: 1px;-fx-border-style: solid;-fx-background-color: " + color.tostring().replace("0x", "#") + ";"); 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -