Details
-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
fx2.0
-
None
-
Win 7 64-bit, 32-bit JRE, JavaFX 2.0 b45
Description
TilePane claims that it will make all the children the same size (if they are resizeable). It does not.
Try:
package tiletest;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.TilePane;
import javafx.stage.Stage;
public class TileTest extends Application {
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Hello World");
Group root = new Group();
Scene scene = new Scene(root, 300, 250);
String style = "-fx-padding: -1 0.5 0 0;"
+ "-fx-margin: 0;"
+ "-fx-text-fill: white;"
+ "-fx-alignment: center;"
+ "-fx-content-display:center;"
+ "-fx-font-size: 8px;"
+ "-fx-border-radius: 2;"
+ "-fx-border-width: 1;"
+ "-fx-border-insets: 0;"
+ "-fx-background-radius: 1;"
+ "-fx-background-insets: 0.9;"
+ "-fx-border-color: black;"
+ "-fx-background-color: grey;";
TilePane tiles = new TilePane();
Button btnE = new Button("E");
Button btnI = new Button("i");
Button btnO = new Button("O");
System.out.println("Button resizeable: "+btnI.isResizable());
btnE.setStyle(style);
btnI.setStyle(style);
btnO.setStyle(style);
tiles.getChildren().add(btnE);
tiles.getChildren().add(btnI);
tiles.getChildren().add(btnO);
root.getChildren().add(tiles);
primaryStage.setScene(scene);
primaryStage.show();
}
}
Try:
package tiletest;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.TilePane;
import javafx.stage.Stage;
public class TileTest extends Application {
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Hello World");
Group root = new Group();
Scene scene = new Scene(root, 300, 250);
String style = "-fx-padding: -1 0.5 0 0;"
+ "-fx-margin: 0;"
+ "-fx-text-fill: white;"
+ "-fx-alignment: center;"
+ "-fx-content-display:center;"
+ "-fx-font-size: 8px;"
+ "-fx-border-radius: 2;"
+ "-fx-border-width: 1;"
+ "-fx-border-insets: 0;"
+ "-fx-background-radius: 1;"
+ "-fx-background-insets: 0.9;"
+ "-fx-border-color: black;"
+ "-fx-background-color: grey;";
TilePane tiles = new TilePane();
Button btnE = new Button("E");
Button btnI = new Button("i");
Button btnO = new Button("O");
System.out.println("Button resizeable: "+btnI.isResizable());
btnE.setStyle(style);
btnI.setStyle(style);
btnO.setStyle(style);
tiles.getChildren().add(btnE);
tiles.getChildren().add(btnI);
tiles.getChildren().add(btnO);
root.getChildren().add(tiles);
primaryStage.setScene(scene);
primaryStage.show();
}
}