This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

JavaFX custom controls

We started with our JavaFX UI in January and we are on the home stretch!
All features were implemented and we have some Feature Requests and known Bugs in our Ticketing system and some open Issues in the JavaFX ticketing system (JIRA, at the moment).

At the beginning we thought that 2 months will be sufficient to implement the whole UI :) We were very optimistic but not far away from the reality but we didn't know that JavaFX had a lot of missing pieces.

Missing pieces?

Don't get me wrong, because JavaFX is an awesome UI toolkit and will be a perfect replacement for Swing, but it needs some real world applications. Yes, applications and not fancy hello world examples. Sure, there are some great applications but most use custom controls because of problems with standard controls. The overall performance is still not perfect and there's still a lot of tuning potential. Currently a swing application acts faster without delays.

The biggest problem for us was that standard controls like Toolbar, Menus didn't work as expected and other controls like DesktopPane or Internal Frame weren't available. We didn't find a date + time combobox editor. Some standard controls like Button, CheckBox or RadioButon didn't offer specific alignment options and another problem was the coding philosophy because many useful methods are public final or private. You can't replace internal listeners or remove internal listeners because you can't access all list elements.

But this article shouldn't cover our development problems because many of them will be solved with Java8 u60 and we have custom controls for the rest. Currently we have many useful classes for our UI and also for you, because we tried to implement all extensions independent of JVx. This article gives a short overview.

Re-usable controls and classes

We have some additional classes without images:

  • FXNullPane

    Acts like a Swing panel with null layout.

  • FXSceneLocker

    From the javadoc: The FXSceneLocker is a static helper utility that allows to to lock a Scene, meaning that only events that belong to the locking Node or its children are processed. If a Scene is locked by multiple Nodes, that last one does receive events.

You'll find all other utilities and controls in the dev repositoriy. The ext Package is independent of JVx. We use it as base for our UI implementation.

5 Responses to “JavaFX custom controls”

  1. Michael says:

    The FXDateTimePicker looks more like a minesweeper game than something to use for flexible & fast input.

  2. rjahn says:

    Fast input isn't a problem :)

    Do you have any ideas. We're open for everything!

  3. Michael says:

    With that dialog fast input is very much a problem. Imagine how many clicks you have to make if you need to change everything in that control. Ideas depend on what you're trying to achieve, i. e. something that looks good or something that's convenient to use. I suggest looking at some of the html 5 calendar controls. They got very good ideas. Example: Instead of the combobox for the month, one could make 2 rows of the months in 3 letter names and highlight the selected month. That way it's just 1 click to change the month. The year could be something like a combobox, when you click on it you see a larger list of years. The current year mustn't be the first, it must be in the middle of the list so that you can conveniently change to previous or later years. And you could position the change buttons left/right instead of the small up/down buttons. The time could be some sliders with fixed interval, they could also be positioned vertically to the right. And instead of up/down buttons the time could be changed by hovering over the numbers and using the mouse wheel (but that would be something the user would have to know). In fact, you could have an additional textfield below and change everything via mouse wheel, depending on whether you are over day/month/year, etc. Just some initial ideas :-)

  4. rjahn says:

    The dialog won't be used... It was for the screenshot. It's a combobox, but you could use the pane "standalone".

    Thanks for your input!
    Sure, there are many calendar controls: Google results
    :)

Leave a Reply

Spam protection by WP Captcha-Free