JavaFX : JfxFrame

Hi all,

I have developed a JfxFrame for JavaFX for my own needs. Now you can have your JavaFX code without a JavaFX application. I share it as it might interest others. Please find below a small code sample.

 

To use it you have to download Ermine.jar

Of course you can create several frames, just by allocating and displaying several instances.

At first glance, it looks like the old Swing or AWT frame, but it is a bit different as it is coming with a callback method which is executed inside the correct JavaFX Thread. I have created such frame not by nostalgia but for having a class containing main without JavaFX application. This way you can use JavaFX everywhere inside your own architecture and not only from a class with JavaFX’s main.

In my opinion the JavaFx code should be a leaf in architecture as other application parts like data processing, database access, network server etc..

To create this frame, I had to add a method known by Swing coder invokeAndWait that might also interest some JavaFX coders :

Next time I will present you new features of RefPointLayout.

Cheers.

Mik

 

 

 

JavaFX layout

Hi,

At last, I have started to work on JavaFX. For my first development, I share with you a new Layout named RefPointLayout. It’s principal is simple as you define one node position or two points node relatively to some reference points.

With one point you can set only the node position. With two points you can set the node position and size. The below diagram shows you the main key points of this layout :

refpoint

Let’s see together an example with scaled node and fixed size node. The HMI contains two scalable list views and two fixed size buttons. For the list view of the left side, its top left corner is relative to the top left parent reference point and the bottom right corner is relative to the bottom centre parent reference point. This way it is following window resize with a constant delta x and y. For the two buttons their position is set relatively to the middle centre reference point.

RefPointLayoutThe code to create the above HMi is the following :

In order to compile the above code, you need to download Ermine.jar. The layout is also available as a pane. Personally I quite like it as an independent layout interface. In the future, I might improve it by adding some customed reference points.

Cheers,

Mik

 

capcaval_logo_small Ermine_logo_small