A GPA calculator in JavaFX attempting to use the Model View Controller (MVC) pattern
- Dynamically recalculates GPA when any information is changed
- Calculate GPA for specific classes
- Add and remove classes
- Optionally include your existing GPA to see how the current semester affects it
- Input validation
A GPA is simply a weighted average. You can see more examples on UVM's help page
The calculate GPA, you multiply the number of credits by the numerical grade for a class and divide by the total credits
Grade | Value |
---|---|
A+ | 4.0 |
A | 4.0 |
A- | 3.67 |
B+ | 3.33 |
B | 3.0 |
B- | 2.67 |
C+ | 2.33 |
C | 2.0 |
C- | 1.67 |
D+ | 1.33 |
D | 1.0 |
D- | 0.67 |
F | 0.0 |
When including your current GPA, this program may yield a total GPA that's off by 0.01. This is because your school may round up or down when calculation your overall GPA and including your Overall GPA may be slightly different than entering all the classes individually.
UVM rounds down when calculating your overall GPA. Thus 3.5995 is just 3.59 and not 3.60. This program also reflects that convention even if it's not mathematically equivalent.
- JavaFX Java GUI Tutorial - 31 - Introduction to FXML Bucky FXML
- JavaFX Java GUI Tutorial - 32 - Controllers in FXML
- 031_fxml Github code Bucky Github sample
- Is @FXML needed for every declaration? - Stack Overflow
@FXML
annotation- JavaFX FXML Controller Example - Java Code Geeks more on @FXML
- Introduction to FXML javadox
@FXML
- JavaFX 2 Event Handlers and Change Listeners
TextField
events (long way) - JavaFX FXML controller - constructor vs initialize method - Stack Overflow
- Setting stylesheets declaratively in FXML - Stack Overflow WORKS!
- Set multiple styleClass values - Stack Overflow css class (styleClass must be Capitalize)
- Connecting SceneBuilder edited FXML to Java code javafx FXML event handling
- JavaFX css width - Stack Overflow
-fx-pref-width
,-fx-min-width
,-fx-max-width
- JavaFX CSS Reference
Ctrl+F
-fx-pref-width
- JavaFX CSS Reference
- Java-Buddy: Create GridPane using FXML
FXML GridPane
- RequestFocus() in TextField doesn't work Run after
initialize()
is done:
also via lambda:Platform.runLater(()->class1Grade.requestFocus());
- JavaFx TextField focus lost formatting ChangeListener for
onBlur()
(leaveTextField
)
but only for TextField, not another label - December 2017 Links
- StackOverflow - ChoiceBox/ComboBox populate from ArrayList
- GitHub - ComboBox FXML example
- Bucky - ComboBox
- Bucky - ChoiceBox (didn't use since arrows keys don't change choices)
- Bucky - Dropdown Selection Changes
- StackOverflow - What is the recommended way to make a numeric TextField in JavaFX? Integer TextField validation
- StackOverflow - JAVAFx TextField Validation Decimal value Decimal TextField validation
- How to Use the Focus Subsystem Meant for Swing, but similar in JavaFX
- Remove a row from a GridPane Remove row from GridPane method
- StackOverflow - JavaFX getting scene from a controller Get containing
Scene
from GUI object - StackOverflow - JavaFX: How to get stage from controller during initialization? Get containing
Stage
from GUI object - Java2s - stage.sizeToScene() Rezie stage to scene size
- Youtube - MVC Java Tutorial Great video, provided the main motivation to use MVC, but it uses Java swing and I had to adapt it to JavaFX
- UI Control Sample - JavaFX Tutorials and Documentation Finally just copied the stuff inside
setOnAction()
to separate inner class in Controller - Handling JavaFX Events: Processing Events | JavaFX 2 Tutorials and Documentation
- Dead ends
- JavaFX separating event handling from controller class - Stack Overflow not enough details
- javafx multiple buttons to same handler - Stack Overflow initial thougts, but didn't pan out
- Multiple Buttons To Same Action Listener right idea, but using ActionListener instead of EventHandler
- JavaFX 8 Event Handling Examples JavaFX button handing and much more
- 4 Working with Event Handlers
addEventHandler()
- Difference between setOnXXX() method and addEventHandler() JavaFx - Stack Overflow
- Handling Events with Listeners - vaadin anonymous inner classes
- UI Control Sample - JavaFX Tutorials and Documentation Finally just copied the stuff inside
- StackOverflow - Applying MVC With JavaFx
- Stack Overflow - javafx: Separate EventHandler and gui code
- Less Helpful
- Youtube - JavaFX Software Tutorial: Calculator (MVC) long
- Youtube - JavaFX Software: Alarm Clock (MVC)
https://gjf2a.blogspot.com/2015/01/dynamically-adding-javafx-controls.html