Java Reference
In-Depth Information
NetBeans IDE generated the following sources after choosing to create a new
JavaFX application for deployment via a browser:
package org.java8recipes.chapter17.recipe17_01;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
/**
*
* @author cdea
* Update: Juneau
*/
public class MyJavaFXApp extends Application {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Hello World");
Group root = new Group();
Scene scene = new Scene(root, 300, 250);
Button btn = new Button();
btn.setLayoutX(100);
btn.setLayoutY(80);
btn.setText("Hello World");
btn.setOnAction((ActionEvent event) -> {
System.out.println("Hello World");
});
root.getChildren().add(btn);
Search WWH ::




Custom Search