|
1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import javafx.application.Application;
- import javafx.scene.Parent;
- import javafx.scene.Scene;
- import javafx.scene.layout.GridPane;
- import javafx.scene.control.Button;
- import javafx.event.ActionEvent;
- import javafx.stage.Stage;
- import javafx.event.EventHandler;
-
- class Lytter implements EventHandler<ActionEvent> {
- @Override
- public void handle(ActionEvent ae) {
- javafx.application.Platform.exit();
- }
- }
-
- public class GUI extends Application {
- @Override
- public void start(Stage win) throws Exception {
- GridPane root = new GridPane();
-
- Scene scene = new Scene(root, 900, 700);
-
- Button button = new Button("Si hei");
- Lytter knappelytter = new Lytter();
- button.setOnAction(knappelytter);
- root.getChildren().add(button);
-
- win.setScene(scene);
- win.show();
- win.setTitle("et vindu!");
- }
-
- public static void main(String[] args) {
- launch(args);
- }
-
- public GUI() {
- super();
- }
- }
|