Skip to content

Commit b9b653d

Browse files
author
Volker Aufschild
committed
simple HelloWorld example
1 parent 82c6db8 commit b9b653d

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
*
3+
*/
4+
package de.voder.tutorial.javafx;
5+
6+
import javafx.application.Application;
7+
import javafx.event.ActionEvent;
8+
import javafx.event.EventHandler;
9+
import javafx.scene.Scene;
10+
import javafx.scene.control.Button;
11+
import javafx.scene.layout.StackPane;
12+
import javafx.stage.Stage;
13+
14+
/**
15+
* @author volker
16+
*
17+
*/
18+
public class HelloWorld extends Application {
19+
20+
/* (non-Javadoc)
21+
* @see javafx.application.Application#start(javafx.stage.Stage)
22+
*/
23+
@Override
24+
public void start(Stage primaryStage) throws Exception {
25+
primaryStage.setTitle("Voder's Hello World Example");
26+
Button btn = new Button();
27+
btn.setText("Say 'Hello'!");
28+
btn.setOnAction(new EventHandler<ActionEvent>(){
29+
30+
@Override
31+
public void handle(ActionEvent arg0) {
32+
System.out.println("Hello World!");
33+
}
34+
35+
});
36+
37+
StackPane root = new StackPane();
38+
root.getChildren().add(btn);
39+
primaryStage.setScene(new Scene(root, 300, 250));
40+
primaryStage.show();
41+
}
42+
43+
/**
44+
* @param args
45+
*/
46+
public static void main(String[] args) {
47+
launch(args);
48+
49+
}
50+
51+
}

0 commit comments

Comments
 (0)