Podcast
Questions and Answers
What is the primary purpose of using SceneBuilder in a multi-scene JavaFX application?
What is the primary purpose of using SceneBuilder in a multi-scene JavaFX application?
- To write Java code directly
- To create and edit FXML view files (correct)
- To package application JAR files
- To manage external resources
Which component is directly responsible for loading the initial scene graph in a JavaFX application?
Which component is directly responsible for loading the initial scene graph in a JavaFX application?
- SceneBuilder
- ViewController
- Resource folder
- App.java main file (correct)
What should be established in the initial viewController to facilitate scene graph swapping?
What should be established in the initial viewController to facilitate scene graph swapping?
- Private resource folder
- FXML resource
- A static public method or field (correct)
- Secondary Event handler
Which step is NOT part of creating a multi-scene JavaFX application?
Which step is NOT part of creating a multi-scene JavaFX application?
What is the role of the private field in the secondary viewController?
What is the role of the private field in the secondary viewController?
What does a self-contained JAR file for a JavaFX application include?
What does a self-contained JAR file for a JavaFX application include?
Which tool is mentioned for packaging JavaFX applications?
Which tool is mentioned for packaging JavaFX applications?
What must an initial scene graph contain to properly utilize scene swapping?
What must an initial scene graph contain to properly utilize scene swapping?
What resource folder is suggested to be created for storing images in a JavaFX application?
What resource folder is suggested to be created for storing images in a JavaFX application?
What does the application developer fully control in relation to the Java Runtime used by their application?
What does the application developer fully control in relation to the Java Runtime used by their application?
Which part of the JavaFX application configuration defines how resources are managed and packaged?
Which part of the JavaFX application configuration defines how resources are managed and packaged?
Which command in NetBeans is used to package a JavaFX application for deployment?
Which command in NetBeans is used to package a JavaFX application for deployment?
What is the first step in creating a JAR file using NetBeans?
What is the first step in creating a JAR file using NetBeans?
What should the main class in a JavaFX application extend for it to be executable?
What should the main class in a JavaFX application extend for it to be executable?
Which plugin must be added to the pom.xml for creating an executable JAR file?
Which plugin must be added to the pom.xml for creating an executable JAR file?
What should be done to ensure the release-profile actions are set up correctly?
What should be done to ensure the release-profile actions are set up correctly?
What is the purpose of saving resources in the src/main/resources folder?
What is the purpose of saving resources in the src/main/resources folder?
After cleaning and building the project in NetBeans, where can the resultant JAR files be found?
After cleaning and building the project in NetBeans, where can the resultant JAR files be found?
What must be done with the JAR file once created to run the program as a self-contained application?
What must be done with the JAR file once created to run the program as a self-contained application?
What step comes immediately after creating a new Java Class named Main?
What step comes immediately after creating a new Java Class named Main?
Flashcards
Multi-Scene JavaFX App
Multi-Scene JavaFX App
A JavaFX application with multiple scenes that can be switched between.
FXML View Files
FXML View Files
XML files that describe the visual layout and structure of a JavaFX scene.
Scene Builder
Scene Builder
A tool to design the graphical user interface (GUI) for JavaFX applications.
View Controller
View Controller
Signup and view all the flashcards
Application JAR File
Application JAR File
Signup and view all the flashcards
Scene Graph Swap
Scene Graph Swap
Signup and view all the flashcards
Resources Folder
Resources Folder
Signup and view all the flashcards
App.Java (or Main App)
App.Java (or Main App)
Signup and view all the flashcards
NetBeans (IDE)
NetBeans (IDE)
Signup and view all the flashcards
Start Method
Start Method
Signup and view all the flashcards
JavaFX Deployment
JavaFX Deployment
Signup and view all the flashcards
NetBeans Maven FXML Project
NetBeans Maven FXML Project
Signup and view all the flashcards
Executable JAR
Executable JAR
Signup and view all the flashcards
Maven Shade Plugin
Maven Shade Plugin
Signup and view all the flashcards
src/main/resources folder
src/main/resources folder
Signup and view all the flashcards
Main class
Main class
Signup and view all the flashcards
Project Configuration
Project Configuration
Signup and view all the flashcards
Release Profile
Release Profile
Signup and view all the flashcards
Clean and Build
Clean and Build
Signup and view all the flashcards
Target Folder
Target Folder
Signup and view all the flashcards
Study Notes
CSC 2040: Multi-Scene & App Deployment
- Course name: CSC 2040
- Topic: Multi-Scene & App Deployment
- Objectives:
- Demonstrate creating multi-scene JavaFX applications.
- Incorporate SceneBuilder for application setup.
- Configure JavaFX applications.
- Manage and package external resources.
- Construct self-contained JAR files for JavaFX applications.
Week 12 Agenda
- JavaFX Multi-Scene App
- Application JAR Files
- NetBeans IDE Packaging Tool
- Creating Self-Contained Applications
- TODO
- Resources for Help
Multi-Scene App: Views
- Create new FXML view files using NetBeans.
- Edit files using SceneBuilder.
- Save FXML files.
- Example views include "Initial Scene Graph" and "Secondary Scene Graph".
- Use elements like
BorderPane
,ImageView
,TextArea
, etc.
Multi-Scene App: ViewControllers
- Create controllers for each view in NetBeans.
- Move controllers to source folders.
- Create a new resource folder named "images".
- Save images to the resources.
Multi-Scene App: Main App
- Open the main file (e.g., App.java) in NetBeans.
- Update the
start
method to load the initial scene graph. - Take note of shared private scene and shared public
setRoot
method. - Use
loadFXML
to swap scene graphs.
Multi-Scene App: Scene Graph Swap
- Open the initial
viewController
- Setup the event handler to trigger scene graph swap
- The
initial viewController
has a static public method or field to access data from thesecondary viewController
Multi-Scene App: ViewController 2
- Open secondary viewController
- Create private field for name data.
- Set field value on the method or field of the primary viewController.
- Access data in the
secondary viewController
.
Application Package: JAR File
- JavaFX applications can be packaged as platform-specific JAR files.
- JAR files contain compiled class files and application resources.
- They offer hassle-free compatibility.
- Application version is controlled by the developer.
- No Java Runtime installation is needed to run deployed application.
NetBeans IDE Packaging Tool
- NetBeans Maven FXML projects can be packaged.
- Use the "Clean and Build" command to package JavaFX applications.
Creating JAR File: Step-by-Step
- Create a Maven FXML project in NetBeans.
- Ensure resources are in the
src/main/resources
folder. - Create a new Java class (e.g., Main) extending Application.
- Update
pom.xml
with Maven Shade plugin. - Set
mainclass
element inpom.xml
- Run the project in NetBeans.
- Copy the JAR file to operating system file explorer.
- Run the JAR file by double-clicking it.
Creating JAR File: Step-by-Step (Continued)
- Change the project configuration to a "release-profile."
- Ensure the release actions are configured properly in the project properties.
Pre-Work Grade & TODO
- Post weekly discussion questions and research solutions to D2L.
- Complete Week 12 Content Module in D2L to 100%.
Help and Resources
- Student office hours.
- Email address.
- On-campus tutoring.
- 24/7 online tutoring.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.