Question: Step 1 : Login Scene and LoginController.java Login.fxml First, open Login.fxml in SceneBuilder and design the scene. You don t necessarily need to exactly match
Step : Login Scene and LoginController.java
Login.fxml
First, open Login.fxml in SceneBuilder and design the scene. You dont
necessarily need to exactly match what I did, but the closer you are the easier
I will be able to help with debugging. Most of it should be straightforward but
note that the password field should be a PasswordField instead of a TextField.
The only difference is that typed letters automatically appear as
Once the scene is laid out, make sure to set the controller to LoginController.
Then, ensure you set IDs for each of the elements listed in LoginController.
This is nameField, passwordField, and errorLabel. Also, ensure the buttons have methods listed
as events openSettings for Settings login for Calculator Login Once youre satisfied with
that, clear the text of the errorLabel so that it starts empty.
LoginController.java
login: The goal is to validate the username and password and open the calculator scene if so
Do this by manually checking if both the contents of nameField and passwordField match the
contents of username and password respectively. If both do call openCalculator; Else, set
errorLabel to be Invalid login credentials.
Additionally, in login put these lines immediately after calling openCalculator It closes the
login screen when loading the calculator screen.
Button caller ButtoneventgetSource;
Stage stage StagecallergetScenegetWindow;
stage.close;
Testing: with this filled in you can now do more testing. If you run the program to the login
screen and enter admin and password respectively hardcoded values you should be able
to load the calculator. If you didnt in step you may need to open Calculator.fxml in
SceneBuilder and make sure the controller is set correctly to have this
work. Clicking settings will load an empty scene, which leads you into...
Step : Settings Scene and SettingsController.java
Settings.fxml
First, open Settings.fxml in SceneBuilder and design the scene. Its worth
note that this screen only simulates the profile saving there is no actual
saving of birthday or preferred language. The only saved part is the new
username and password if they are set. The new elements here are:
DatePicker: This element works with virtually effort. Just drag it into the scene next to a label
and it works automatically.
RadioButton: These also work mostly automatically. However, you must set the Toggle Group
property of both buttons. It doesnt matter what, as long as they are the same. I suggest
language This makes it so you can only select at a time, not both. Test this to make sure it
works before moving on
Like before, set the controller to SettingsController and set the IDs and events for each element.
You need IDs for datePicker, usernameField, passwordField, radioJava, radioPython,
errorLabel, and confirmLabel. Update should have event set to updateInfo, Save Profile
should be set to save, and Return to Login should be set to returnToLogin. Lastly, empty the
text of errorLabel and confirmLabel.
SettingsController.java
updateInfo: Lets start here since it only requires lines. The first should update the value of
LoginController.username and LoginController.password to be the current text of
usernameField and passwordField respectively. Next, empty errorLabel and set confirmLabel to
Login credentials updated. Note the lack of error checking for username and password you
could enter both as That is an optional challenge you can try once you get the rest of the
project working :
save: First, as edge cases, empty both errorLabel and confirmLabel. Next, you need to check if
the user has selected a birthday and one of the preferred languages. To check if a date was
selected, you can say ifdatePickergetValue null To check the radio buttons, check if both
have not been selected use isSelected Update errorLabel accordingly for either You didnt
select a birthday. or You didnt select a preferred language. If neither case happens, update
confirmLabel to Profile saved.
Testing: You can now do more testing. You should be able to enter the settings screen and
update the login credentials, so make sure of this before moving on The rest of the settings
page should react accordingly based on whether you selected a date or preferred language, try
out various combinations to ensure the errorconfirmation labels act right.
Step : Calculator Scene and CalculatorController.java
Calculator.fxml
Thankfully, you dont have to do any work for this part :) I provided Calculator.fxml
already filled in However, you should examine the layout to ensure you understand
how it works. Each of the numbers is connected to numButton the operators
have operatorButton equals has equals clear has clear and Logout has
logout already implemented. Additionally, note that the text field up to
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
