Tag: gridpanel

JavaFx GridPane – 如何集中元素

我有一个填充了1个字母标签的GridPane 。 这是一张图片: 图片http://sofzh.miximages.com/java/xu8o79sr.jpg 这是代码: int charSpacing = 1; int charsInWidth = 28; int charsInHeight = 16; double charWidth = 15; double charHeight = 20; GridPane gp = new GridPane(); gp.setAlignment(Pos.CENTER); Label[] tmp = new Label[charsInHeight*charsInWidth]; String text = “W”; int currArrPos = 0; for(int y = 0; y < charsInHeight; y++) { HBox hbox […]