package bug; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.CheckBox; import javafx.scene.control.Control; import javafx.scene.control.Label; import javafx.scene.control.OverrunStyle; import javafx.scene.control.RadioButton; import javafx.scene.layout.HBox; import javafx.scene.layout.Region; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class Bug extends Application { LayoutSize single_line_layout = new LayoutSize(150, 20, 115, 20, 115, 20); final static String WRAPPED_TEXT = "wrapped wrappped wrapppped wrappppped wrapppppped wrappppped wrapppped wrappped wrapped"; public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { String text = WRAPPED_TEXT; OverrunStyle[] styles = OverrunStyle.values(); CheckBox checkbox[] = new CheckBox[styles.length]; RadioButton radiobutton[] = new RadioButton[styles.length]; VBox checkboxs = new VBox(); VBox radiobuttons = new VBox(); checkboxs.setSpacing(10); radiobuttons.setSpacing(10); for (int i = 0; i < styles.length; i++) { OverrunStyle overrun = styles[i]; checkbox[i] = new CheckBox(); radiobutton[i] = new RadioButton(); checkbox[i].setText(text); checkbox[i].setTextOverrun(overrun); checkbox[i].setStyle("-fx-border-color: darkgray"); single_line_layout.apply(checkbox[i]); radiobutton[i].setText(text); radiobutton[i].setTextOverrun(overrun); radiobutton[i].setStyle("-fx-border-color: darkgray"); single_line_layout.apply(radiobutton[i]); checkboxs.getChildren().addAll(new Label(overrun.name()), checkbox[i]); radiobuttons.getChildren().addAll(new Label(overrun.name()), radiobutton[i]); } HBox root = new HBox(); root.setSpacing(10); root.getChildren().addAll(checkboxs, radiobuttons); Scene scene = new Scene(root, 500, 500); stage.setScene(scene); stage.show(); } public static class LayoutSize { public double minWidth; public double minHeight; public double prefWidth; public double prefHeight; public double maxWidth; public double maxHeight; public LayoutSize(double min_width, double min_height, double pref_width, double pref_height, double max_width, double max_height) { minWidth = min_width; minHeight = min_height; prefWidth = pref_width; prefHeight = pref_height; maxWidth = max_width; maxHeight = max_height; } public void apply(Control control) { control.setMinWidth(minWidth); control.setMinHeight(minHeight); control.setPrefWidth(prefWidth); control.setPrefHeight(prefHeight); control.setMaxWidth(maxWidth); control.setMaxHeight(maxHeight); } public void apply(Region region) { region.setMinWidth(minWidth); region.setMinHeight(minHeight); region.setPrefWidth(prefWidth); region.setPrefHeight(prefHeight); region.setMaxWidth(maxWidth); region.setMaxHeight(maxHeight); } } }