import javafx.application.Application; import javafx.geometry.Insets; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.TextField; import javafx.scene.layout.VBox; public class App extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) throws Exception { TextField numInput = new TextField(); Button doubleButton = new Button("Dupla"); doubleButton.setOnAction(e -> { String numStr = numInput.getText(); int num = Integer.parseInt(numStr); Integer result = num * 2; numInput.setText(result.toString()); }); VBox vbox = new VBox(); vbox.setPadding(new Insets(10, 10, 10, 10)); vbox.getChildren().addAll(numInput, doubleButton); Scene scene = new Scene(vbox, 300, 250); primaryStage.setScene(scene); primaryStage.show(); } }