NCSSS 2018 JavaFX Workshop

All sample code in the session is present in the directory sampleCode linked at the left.

Prepare your Lappy!

You will want to do one of these. You will need to have a developer kit for Java 9 or later (10) on your lappy. Instructions for the NetBeans and Eclipse IDEs are also present. I will use the good old command line with vim on my Mac.

Here is a template for FX programs. You should try to compile and run this in advance. You can download it in the navigation area to the left.

import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Template extends Application
{
    public Template()
    {
    }
    @Override
    public void init()
    {
    }
    @Override
    public void start(Stage primary)
    {
        primary.setTitle("Template");
        primary.show();
    }
    @Override
    public void stop()
    {
    }
    //Main is actually optional.
    public static void main(String[] args)
    {
        launch(args);
    }
}

Running this app results in this window.

image of basic FX window

Purpose and Audience This workshop is aimed at people who have a good working knowledge of programming basics, and Java fundamentals such as classes, inheritance, abstract classes, interfaces, and generics (that <T> stuff). It is very helpful if you are comfortable reading and applying the JavaAPI guide.

No prior knowledge of GUI programming is assumed. You are encouraged to follow along, experiment, raise questions and dicuss ideas. To some extent, this workshop will be driven by audience interest. This is a "dirty hands" experience. I hope you leave this with some sample code and an sense of adventure about exploring the world of GUI programming.

You will see that your students gain a whole new feeling of power over their computers the first time they make a GUI run and when they build their first actual application.

Also, we will spend a little time on the new jshell REPL (read-evaluate-print loop) and use it to demonstrate some Java8 concepts we will find useful.

Learning Resources In case you want to cheat and peek over the transom, here are some nice materials germane to this workshop.

Next: application.php