JavaFX Cookbook
IA tooling, not an exam topic: JavaFX is the toolkit most students use to build the application for their Internal Assessment. It is not part of the assessed IB CS syllabus, so nothing on these pages is examinable. Use them as practical building blocks for your own app.
What this is
A set of small, self-contained JavaFX techniques you can drop into your IA application. Each entry is a recipe: a short, generic code pattern that does one thing, with a clear note on which names and values to change so it fits your own project. Think of them as parts. Pick the table recipe, the file-picker recipe, and the confirm-dialog recipe, then wire them together into the app you are building.
The examples are deliberately small and generic. They show the move, then hand it back to you to build your own version. That is also an authenticity point: your IA must be your own work, so these are patterns to adapt, never finished features to copy.
How to use it
- Find the recipe whose title names what you want to do.
- Read The pattern for the minimal code, with its imports listed.
- Use Make it your own to see exactly which names, values, and messages to change.
- Check Watch out for for the common mistake or null case.
- Follow Mix with to the recipes that commonly combine with it.
You do not need to read these in order, and you do not need to have read one recipe to use another. Cross-links are a bonus, not a requirement.
What you should already know
These pages assume one year of Java: classes and objects, constructors, encapsulation, inheritance, arrays, ArrayList, loops, conditionals, methods, basic file reading and writing, and try/catch. They also assume you are building with FXML in SceneBuilder and a controller class per screen, which is the MVC setup taught in the OOP pages. Where a recipe uses Java that sits outside the exam-style subset (for example a lambda), it says so in one line so you do not mistake it for examinable material.
The pages
| Page | What it covers |
|---|---|
| Controlling UI state | Enabling and disabling controls, focus, reacting to Enter |
| Dialogs and feedback | Information and confirmation dialogs, catching bad input |
| Input controls | Radio buttons, checkboxes, combo boxes, date pickers, numbers-only fields |
| Showing data in a table | TableView, filling it, reading the selected row, live filtering |
| Time, progress, and animation | Timeline beats and progress bars |
| Files and persistence | FileChooser, saving and loading text |
| Exporting and sharing | CSV export, email from a button, opening a web page |
| App structure and navigation | initialize, menus, quitting, second windows, passing data, tabs, CSS |
| Charts and graphs | Line, bar, and pie charts, and updating them |
| Images and media | Showing images, image buttons, sound |
| Drawing and animation | Canvas drawing, mouse handlers, game loops |
All examples use default JavaFX with no third-party libraries, with one stated exception: the database recipe referenced from the files page uses a single small SQLite driver. Everything stays in JavaFX, with no Swing.