javafx 8 - GridPane Ignoring TextField.setPrefColumnCount -


i'm attempting use textfield.setprefcolumncount() give me different sized text fields within gridpane. gridpane sizing of fields longest field. doing wrong here, or need explicitly set maximum size of fields preferred size fields?

public class testproject extends application {      @override     public void start(stage primarystage) {          borderpane base = new borderpane();         gridpane inner = new gridpane();          inner.sethgap(4);         inner.setvgap(4);         inner.setpadding(new insets(8));         inner.setmaxwidth(double.max_value);         inner.setgridlinesvisible(true);         inner.setstyle("-fx-border-color:red");          label la = new label("label a");         label lb = new label("label b");         label lc = new label("label c");          textfield ta = new textfield();         ta.setprefcolumncount(30);          textfield tb = new textfield();         tb.setprefcolumncount(15);          textfield tc = new textfield();         tc.setprefcolumncount(6);          inner.addrow(0, la, ta);         inner.addrow(1, lb, tb);         inner.addrow(2, lc, tc);          base.setcenter(inner);         base.setprefwidth(800);         base.setprefheight(600);          scene scene = new scene(base);          primarystage.settitle("gridpane textfield test");         primarystage.setscene(scene);         primarystage.show();      }      /**      * @param args command line arguments      */     public static void main(string[] args) {         launch(args);     }  } 

you can set gridpane's fillwidth property child nodes this:

gridpane.setfillwidth(ta, false); gridpane.setfillwidth(tb, false); gridpane.setfillwidth(tc, false); 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -