45 lines
1.4 KiB
Markdown
45 lines
1.4 KiB
Markdown
# JavaFX Workshop — Pricing Plans UI
|
|
|
|
## Introduction
|
|
This workshop introduces students to **JavaFX** by building a simple pricing plans user interface.
|
|
Students will learn how to set up a JavaFX project with Maven, create FXML layouts, apply CSS styling, and handle basic UI events.
|
|
|
|
---
|
|
|
|
## Workshop Structure
|
|
|
|
The workshop consists of building a pricing plans page with three tiers (Basic, Pro, Enterprise) and a theme toggle button.
|
|
|
|
### Topics Covered:
|
|
- Setting up a JavaFX project with Maven
|
|
- Creating an FXML layout with containers (`VBox`, `HBox`) and controls (`Label`, `Button`)
|
|
- Writing a Controller class with `@FXML` annotations
|
|
- Handling button click events
|
|
- Switching between Dark and Light themes using CSS
|
|
- Displaying information alerts
|
|
|
|
---
|
|
|
|
## Tasks
|
|
|
|
1. Implement the `Main` class:
|
|
- Load the FXML file using `FXMLLoader`
|
|
- Create a `Scene` and display it on the `Stage`
|
|
|
|
2. Implement the `Controller` class:
|
|
- Wire up the "Shop" buttons to show payment alerts
|
|
- Implement the theme toggle between Dark and Light modes
|
|
|
|
---
|
|
|
|
## Learning Goals
|
|
|
|
By working through this workshop, students should be able to:
|
|
|
|
- Understand the structure of a JavaFX Maven project
|
|
- Read and write basic FXML layouts
|
|
- Connect FXML views to Java controllers
|
|
- Handle UI events with `@FXML` methods
|
|
- Apply and switch between CSS stylesheets dynamically
|
|
- Create and show JavaFX dialogs
|