Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package application;
- import java.beans.EventHandler;
- import javafx.application.Application;
- import javafx.event.ActionEvent;
- import javafx.event.*;
- import javafx.scene.Scene;
- import javafx.scene.control.Button;
- import javafx.scene.layout.StackPane;
- import javafx.stage.Stage;
- public class Main extends Application {
- @Override
- public void start(Stage primaryStage) {
- Button przycisk = new Button();
- przycisk.setText("Przycisk");
- przycisk.setOnAction(new EventHandler<ActionEvent>(){
- @Override
- public void handle(ActionEvent arg0){
- przycisk.setText("Klik!");
- }
- });
- StackPane root = new StackPane();
- root.getChildren().add(przycisk);
- Scene ramka = new Scene(root, 300, 250);
- primaryStage.setScene(ramka);
- primaryStage.show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment