Week10_JavaFX
Graphical User Interface:
Introduction to Java GUI Construction with JavaFX
Event Based Programming
Application 1: GUI Hello World
Code for Hello World
package helloworldgui;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.stage.Stage;
// JavaFX applications must extend the Application class
public class HelloWorldGUI extends Application {
@Override
public void start(Stage primaryStage) {
// Sets the title of the Stage (Window)
primaryStage.setTitle("Hello World!");
// Create a Label to display some text.
Label label = new Label("Hello World!");
// Create a Scene to hold the content
Scene scene = new Scene(label);
// Add the Scene to the Stage
primaryStage.setScene(scene);
// Show the Stage!
primaryStage.show();
}
}JavaFX
Overview of the JavaFX GUI Structure

Stage
Scene
Nodes
A Closer Look at Label
Top Level Containers
Some more JavaFX Control Nodes
Application 2: Get area
Layout Management
Events
Application 2: Code
Application 3: Digital Random shapes
Responding to Mouse Clicks
EventHandler implementation
Imports
Last updated







