Created
March 19, 2016 06:56
-
-
Save Cartman0/95b33fc5c6f8188b6cab to your computer and use it in GitHub Desktop.
JavaFX でHelloWorld (NetBeans のテンプレート)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package javafxapplication; | |
import javafx.application.Application; | |
import javafx.event.ActionEvent; | |
import javafx.scene.Scene; | |
import javafx.scene.control.Button; | |
import javafx.scene.layout.StackPane; | |
import javafx.stage.Stage; | |
public class JavaFXApplication extends Application { | |
@Override | |
public void start(Stage primaryStage) { | |
Button btn = new Button(); | |
btn.setText("Say 'Hello World'"); | |
btn.setOnAction((ActionEvent event) -> { | |
System.out.println("Hello World!"); | |
}); | |
StackPane root = new StackPane(); | |
root.getChildren().add(btn); | |
Scene scene = new Scene(root, 300, 250); | |
primaryStage.setTitle("Hello World!"); | |
primaryStage.setScene(scene); | |
primaryStage.show(); | |
} | |
public static void main(String[] args) { | |
launch(args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment