Lecture 1 - JavaFX Intro
Lecture 1 - JavaFX Intro
Lecture 1: Introduction to
JavaFX
Quantum Toolkit
Prism
JavaFX Glass Windowing Media Web
Graphics Engine Java Open Toolkit Engine Engine
D3D
2D GL
@Override top-level
root.getChildren().add(btn);
main container
entry public void start(Stage primaryStage) { for all
point Button btn = new Button(); content Scene scene = new Scene(root, 300, 250);
@Override primaryStage.show();
} launch(args);
}); }
**the content of
} the scene is
represented as a
hierarchical scene
Now Add another stage with a button to the same program graph of nodes
JavaFX Program Basic Structure
12
Becomes:
import javafx.application.Application;
…
public class MyProgram extends Application
{
// Body of class
}
JavaFX Program Layout
13
Stage – This is the outer shell of your application and contains the entire
program
Scene – The object directly contained by the stage. In the program when
you want to switch to another view you can also have the Stage change to
a different Scene.
The Root Pane/Container – This object holds all the parts of the application,
like buttons, labels, textfields, etc.
14