package application; import javafx.application.Application; import javafx.geometry.Pos; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.RadioButton; import javafx.scene.control.TextField; import javafx.scene.control.ToggleGroup; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; public class Main extends Application { @Override public void start(Stage primaryStage) { Pane p = new Pane(); Label l1 = new Label("Text Field"); TextField t1 = new TextField(); t1.setText("katya"); HBox h = new HBox(5); h.setLayoutX(50); h.getChildren().addAll(l1, t1); HBox h2 = new HBox(5); h2.setLayoutY(50); RadioButton b1 = new RadioButton("Left"); RadioButton b2 = new RadioButton("Center"); RadioButton b3 = new RadioButton("Right"); ToggleGroup to = new ToggleGroup(); to.getToggles().addAll(b1, b2, b3); Label l2 = new Label("Colum Size"); TextField t2 = new TextField(); h2.getChildren().addAll(b1, b2, b3, l2, t2); p.getChildren().addAll(h, h2); b1.setOnAction(e -> { t1.setAlignment(Pos.BOTTOM_LEFT); }); b2.setOnAction(e -> { t1.setAlignment(Pos.BOTTOM_CENTER); }); b3.setOnAction(e -> { t1.setAlignment(Pos.BOTTOM_RIGHT); }); t2.setOnAction(e -> { int size = Integer.parseInt(t2.getText()); t1.setPrefColumnCount(size); }); Scene s = new Scene(p, 300, 100); primaryStage.setScene(s); primaryStage.show(); } public static void main(String[] args) { launch(args); } }