Java

JavaFX Tip 5: Be Observable

Even in this time of total NSA surveillance it is still a good idea to implement your JavaFX controls with observability in mind. This is easy to achieve in JavaFX especially compared to Swing. The Old Days Coming from Swing I was used to spending a lot of energy and time on making custom controls observable. It usually required adding methods to add and remove listeners of a certain type. This listener type was a new interface, the single method of that interface accepted a new event object. To send this event object the control had to "fire" it [...]

By |2021-02-18T13:42:31+01:00July 10th, 2014|FlexGantt, Java, JavaFX, Tips & Tricks|3 Comments

JavaFX Tip 4: Have the Final Word

When developing custom controls for JavaFX I would highly recommend to follow in the footsteps of  the core JavaFX controls and to make the API of your controls as final as possible and to put the "final" keyword in front of all your method declarations. Example In FlexGanttFX I have a lot of code that looks like this: public final Activity getActivityAt(double x, double y) { ... } public final Row getRowAt(double y) { ... } public final void setShowLinks(boolean show) { ... }   Why? When you design a control you have a specific behaviour of the control in [...]

By |2021-02-18T13:42:31+01:00July 9th, 2014|FlexGantt, Java, JavaFX, Tips & Tricks|8 Comments

JavaFX Tip 2: Sharp Drawing with Canvas API

When I initially started out working with the Canvas API I noticed that the results of my rendering code were somewhat blurry and even worse, inconsistent. Some lines were blurry, others sharp. Coming from Swing it took me some time to realize that this was caused by the coordinate system of JavaFX, which allows for double precision rendering. To solve this problem all that is needed is to use coordinates "in the middle". So in my code you now find a lot of methods called snapXYZ() (similar methods can be found in the JavaFX code itself), which first casts [...]

By |2021-02-18T13:42:31+01:00April 10th, 2014|Java, JavaFX, Tips & Tricks|5 Comments

JavaFX Tip 1: Resizable Canvas

While working on FlexGanttFX I had to deal a lot with the JavaFX Canvas node. I am using it to render activities on a timeline. Each row in the Gantt chart is a Canvas node. The user has the option to resize each row individually. So I had to figure out the best way to resize a canvas, which out-of-the-box is not resizable. The listing below shows how this can be accomplished. The main steps needed are: Create a subclass of Canvas. Override the isResizable() method and return true. Override the prefWidth() and prefHeight() methods. Return the values of Canvas.getWidth() and Canvas.getHeight(). [...]

By |2021-02-18T13:42:31+01:00April 10th, 2014|Java, JavaFX, Tips & Tricks|18 Comments

Something to hide? You need HiddenSidesPane

One of my Gantt chart users wanted to use as much real estate on the screen as possible and asked if the scrollbars could be removed. But how do you navigate without scrollbars? Ok, there are all kinds of keyboard shortcuts and of course the usual mouse drag already supported by FlexGanttFX, but a visual control like a scrollbar is something most users would still expect to see these days (at least on desktops). So here is the solution: I used to have a manager who when asked "do you want me to do this or that?" would always [...]

By |2021-02-18T13:42:31+01:00February 24th, 2014|ControlsFX, FlexGantt, Java, JavaFX|4 Comments

And another one: MasterDetailsPane

I finished another JavaFX control today, which I urgently needed for my FlexGanttFX control: a master details pane, which allows the user to show / hide a node with detailed information for a so-called "master" node. My use case is a dual Gantt chart control where a primary (master) Gantt chart is initially shown and then a secondary (details) Gantt chart can be added to the window (stage). By using the MasterDetailsPane the user can easily toggle the visibility of the second Gantt chart at the bottom. At the same time each Gantt chart also has a property sheet [...]

By |2021-02-18T13:42:31+01:00February 4th, 2014|ControlsFX, Java, JavaFX|2 Comments

FlexGantt for JavaFX 8 = FlexGanttFX

For the last 6 months I had the opportunity to port my FlexGantt Gantt charting framework for Swing to JavaFX 8. The concepts behind JavaFX are very different to Swing so the initial ramp-up phase was longer than I wanted it to be. However, in the meantime I feel confident that I am on the right track with my approach to Gantt charting with this new technology. The following videos show the current state of my development efforts. Project Planning The first video shows one of the most common use cases for Gantt charts: the display of a project [...]

By |2021-02-18T13:42:31+01:00January 8th, 2014|FlexGantt, Java, JavaFX|2 Comments

A task monitor popover

My JavaFX developer life currently has a strong focus on the popover control I wrote and contributed to the ControlsFX project. I now find use cases for it all over the place. The latest addition is a task monitor control for the JavaFX version of FlexGantt. The monitor lists the background tasks that are running to load the Gantt chart data for each row. Once again I was inspired by Apple. This time by the "downloads" popover of Safari, which looks like this. Please note the fancy gray divider lines :-)

By |2021-02-18T13:42:32+01:00December 5th, 2013|ControlsFX, FlexGantt, Java, JavaFX|0 Comments