Skip to main content

Posts

Showing posts from May, 2017

Sane JavaFX GUI Code

JavaFX GUI Sanity JavaFX GUI code can be quite chaotic. Such a situation makes it a challenge to understand the code and to troubleshoot it.  JavaFX GUIs are simple in concept but if you try hard enough, you can disorganise it. Disorganised code is a sign of confusion which is a sign of deeper malaise.... JavaFX graphic user interfaces can be built up very systematically by following a simple process: All the GUI is contained in a Stage . This Stage constitutes the visible application window though it does not have to be visible. On this stage is placed a Scene which contains Panes to organise and hold GUI controls such as buttons and text boxes. However, bad programming practice allows a programmer to add controls directly to the Scene . The problem with this practice is that there is no way to lay out such controls in a systematic pattern such as horizontal list or in a grid formation. Each Scene can have zero, one or more Panes . Panes can contain other Panes . Mo