JavaFX is used in order to create a GUI for a java application. It can be generated in code from libraries, importing FXML code, or generated from applications such as SceneBuilder. The general layout of a JavaFX app starts with a stage. The stage then contains a scene. The stage is the overall window for an app. It would be what would have the bar at the top with a close and minimize symbol. The stage then can contain a scene. This scene can be changed by applying a new scene or existing scene to the stage. The way JavaFX works is with nodes of elements, containers, and layouts. A layout or pane can be applied to the root of another. So the scenes are applied to the root of the stage. If the layout allows it, more things can then be put inside the elements already there. This allows for elements to be targeted with code by calling the parent of an element or the root. Certain layouts allow for specific things to be achieved. A default anchor pane allows for any object to be placed anywhere in it, but when the window size changes, the elements may shift around depending on what the properties of the objects are. Buttons, labels, textfields, etc. can all have padding applied to them. This allows the objects not to overlap another object and make sure the elements aren't too far to the window. All of the elements, panes, layouts, etc can be added by just using code. Using a GUI application such as SceneBuilder really simplifies the process. Things can be dragged and placed into where they need to be. This also allows for a quick visual guide as to what is happening. When you code out the actual design, you would need to run the application multiple times in order to see what you actually are creating. Elements can easily be rearranged in the program. New elements can be nested into panes already there easily. The SceneBuilder program speeds up the process tremendously. Events and triggers can be monitored for actions being done to them. These actions can then call a method or other pieces of code in order to take user input and give output. Methods can be used to take in a name and date, and then when a button is pressed, can store the data into a database or file. There are many different types of listeners. When it comes to using objects for the application, properties are used. This allows for the program to know when an objects properties are changed. The structure that we use for a GUI app is the model view controller. The view is the GUI that is shown to the user. This package will contain all the FXML files and the controller java class files. The model contains that java class for the objects that will be used as data for use in the application. CSS can be used to style the elements in the GUI, similar to an html document. The SceneBuilder program allows for not only CSS to be quickly applied to specific elements, but also allows for the programmer to quickly attach methods to are called when an action is triggered such as a forum submit method.
-
Notifications
You must be signed in to change notification settings - Fork 0
TylerGrayStudent/JavaFXTut
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Tutorials for JavaFX
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published