JavaFX Application Structure
- 3 major components
Stage -> Scene -> ScenGraph(Nodes)
Stage
- The primary stage is created by the platform itself.
- There are five types of stages
- Decorated
- Undecorated
- Transparent
- Unified
- Utility
- the created stage object is passed as an argument to the start() method of the Application class
- have to call the show() method to display the contents of a stage.
Scene
- A scene represcents the physical conetents of a JavaFX application.
- Contains all the contents of a scene graph.
- The scene object is added to only one stage.
Scene Graph and Nodes
- Scene Graph is tree-like data structure repersenting the contentes of a scene.
- Node is a visual/graphical object of scene graph.
- Node is of a three types.(Root, Branch/Parent, Leaf Node)
Event Handling
Types of Events
- Foreground Events
- Background Events
Foreground Events
- those event which require the direct interaction of a user.
Background Events
- Those events that require the interaction of end user are known as background events.
Events in JavaFX
- Mouse Event
- Key Event
- Drag Event
- Window Event
Event Handling
this mechanism has the code which is known as an event handler that is executed when an event occurs.
JavaFX provides handlers and filters to handle events.
- target: 이벤트가 발생한 노드
- source: 이벤트가 생성되는 소스가 이벤트 소스임