Lab 3: Image Transformer FXML
Overview
In this assignment, you will incorporate feedback from your instructor from previous assignments and develop a self-contained graphical user interface for the functionality developed in previous assignments.
You must create a JavaFX program using FXML that provides a user interface that matches the screenshot below.

Here is what each button should do:
- Open — Uses a
FileChooser
to allow the user to select an image file to be loaded and displayed. - Save — Uses a file chooser to allow the user to specified the output image location and saves the currently displayed image to the file.
- Grayscale — Converts the currently displayed image to grayscale.
- Invert — Inverts the currently displayed image.
- Brighten — Brightens the currently displayed image.
- Darken — Darkens the currently displayed image.
- Desaturate — Desaturates the currently displayed image.
- Saturate — Saturates the currently displayed image.
Commit 5 - FXML Shell
Due at the end of class Tuesday Week 3
Use SceneBuilder (install it if you
have not done so yet) to create an FXML file that produces a GUI that looks like the
screenshot above. You do not need to include the FXML attributes and actions for
this commit. You must also implement a ImageTransformer
class that extends
Application
, loads the FXML file, and displays the GUI. Use a ImageView
control
for where the image will be displayed.
Commit 6 - Display Image
Due at the end of class Wednesday Week 3
Add a controller class, along with the required FXML attributes and handlers to connect
the GUI to the controller class. Your controller class must have the following handler
methods to respond to the buttons on the UI: void open()
, void save()
,
void grayscale()
, void invert()
, void brighten()
, void darken()
,
void desaturate()
, and void saturate()
.
For this commit, you only need to implement the Open functionality.
Commit 7 - Save and Grayscale
Due at the end of class Wednesday Week 3
For this commit, you need to implement the Save and Grayscale
functionality. You will use the
Color
class to help implement the transformations.
Commit 8 - Lab completed
Due 11pm Monday of Week 3
Ensure that the functionality for the remaining buttons is completed.
Exception Handling
If any problems are encountered with reading the input files or writing the output file,
the program should display a useful error message using the
Alert
class.
Once dismissed, the user should be able to continue using the program.
The program should not crash or display any exceptions.
Just For Fun
Ambitious students may wish to:
- Add other transformations.
- Create a second FXML file that is compatible with your controller class but provides a different user interface.
Acknowledgement
This laboratory assignment, developed by Dr. Chris Taylor.