Java Code Examples for javafx.scene.control.TextField#setAlignment()
The following examples show how to use
javafx.scene.control.TextField#setAlignment() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChangeNBTDialog.java From mcaselector with MIT License | 5 votes |
public FieldCell(Field<?> value, int index) { getStyleClass().add("field-cell"); getStyleClass().add("field-cell-" + (index % 2 == 0 ? "even" : "odd")); this.value = value; textField = new TextField(); getChildren().addAll(new Label(value.getType().toString()), textField); textField.textProperty().addListener((a, o, n) -> onInput(n)); textField.setAlignment(Pos.CENTER); }
Example 2
Source File: TargetDistancePane.java From ShootOFF with GNU General Public License v3.0 | 5 votes |
private TextField createDistanceTextField(double x, double y) { final TextField distanceTextField = new TextField(); distanceTextField.setPromptText("(mm)"); distanceTextField.setLayoutX(x); distanceTextField.setLayoutY(y); distanceTextField.setPrefWidth(75); distanceTextField.setAlignment(Pos.CENTER); distanceTextField.textProperty().addListener(new NumberOnlyChangeListener(distanceTextField)); return distanceTextField; }
Example 3
Source File: Exercise_18_36.java From Intro-to-Java-Programming with MIT License | 5 votes |
@Override // Override the start method in the Application class public void start(Stage primaryStage) { SierpinskiTrianglePane trianglePane = new SierpinskiTrianglePane(); TextField tfOrder = new TextField(); tfOrder.setOnAction( e -> trianglePane.setOrder(Integer.parseInt(tfOrder.getText()))); tfOrder.setPrefColumnCount(4); tfOrder.setAlignment(Pos.BOTTOM_RIGHT); // Pane to hold label, text field, and a button HBox hBox = new HBox(10); hBox.getChildren().addAll(new Label("Enter an order: "), tfOrder); hBox.setAlignment(Pos.CENTER); BorderPane borderPane = new BorderPane(); borderPane.setCenter(trianglePane); borderPane.setBottom(hBox); // Create a scene and place it in the stage Scene scene = new Scene(borderPane, 200, 210); primaryStage.setTitle("Exercise_18_36"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage scene.widthProperty().addListener(ov -> trianglePane.paint()); scene.heightProperty().addListener(ov -> trianglePane.paint()); }