When several controls are put in the vbox the text is not clipped
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.Labeled;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToggleButtonBuilder;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Bug extends Application {
public static final String WRAPPED =
"wrapped wrapped wrapped wrapped wrapped wrapped\n" +
"wrapped wrapped wrapped wrapped wrapped wrapped\n" +
"wrapped wrapped wrapped wrapped wrapped wrapped\n" +
"wrapped wrapped wrapped wrapped wrapped wrapped\n";
public Labeled createControl() {
ToggleButton button = ToggleButtonBuilder.create().selected(false).text(WRAPPED)
.focusTraversable(false).build();
return button;
}
public static void main(String[] args) {
launch(Bug.class, args);
}
@Override
public void start(Stage stage) throws Exception {
VBox root = new VBox();
for (int i = 0; i < 6; i++) {
Labeled contr = createControl();
root.getChildren().add(new Label("Label " + i));
root.getChildren().add(contr);
}
Scene scene = new Scene(root, 200, 400);
stage.setScene(scene);
stage.show();
}
}