Tuesday Jul 01, 2014

News from the Modular JavaFX Application Framework

Once upon a time I started creating an application framework (named 'mfx', for 'modular JavaFX') with JavaFX on the NetBeans Platform. Today I updated it to NetBeans Platform 8 and JDK 8, which means I removed the wrapped jfxrt JAR, since that's now on the classpath of JRE 8.

Added a few small other features and here's a small starter app created on mfx, showing a JavaFX menubar and toolbar populated from the 'menu' and 'toolbars' folders in the NetBeans System FileSystem, as well as some open windows with rudimentary tabs (which should be changed to JavaFX tabs):

Project page:

https://java.net/projects/mfx

The difference between this and the 'efx' framework (which was started by Sven) is that I'm not recreating the whole world, just creating JavaFX components that replace NetBeans Platform Swing components, and then populating their content from the NetBeans System FileSystem.

A nice aspect to all of this is that stylesheets can be used. For example, the menubar is styled like this:

/*Menu Bar*/
.menu-bar {
    -fx-background-color: lightblue;
}
/*Menus*/
.menu .label {
    -fx-text-fill: black;
}
/*Menu Items*/
.menu-item:focused {
    -fx-background-color: greenyellow;
}
.menu-item .label {
    -fx-text-fill: black;
}

A lot still needs to be done, and some parts may not be doable, but anyone interested in working on it with me is welcome to join in and anyone wanting to base their application on it is also welcome to do so.

Minimal NetBeans Platform Dependencies

When you have no more than this dependency in the application module of your NetBeans Platform application, you have all you need for the simplest imaginable NetBeans Platform application.

<dependencies>   
    <dependency>
        <groupId>org.netbeans.modules</groupId>
        <artifactId>org-netbeans-core-startup</artifactId>
        <version>${netbeans.version}</version>
        <type>jar</type>
    </dependency>
</dependencies>

The above results in one direct dependency (i.e., the first node below, which has a lightblue icon, meaning a direct dependency), together with 5 transitive dependencies (with grey icons below):

That starts up the NetBeans Platform, provides no user interface (except a splash screen, which you can supress via -nosplash), and thus lets you create command line tools on the NetBeans Platform.

For a GUI application, add two other direct dependencies, shown below:

<dependencies>   
    <dependency>
        <groupId>org.netbeans.modules</groupId>
        <artifactId>org-netbeans-core-startup</artifactId>
        <version>${netbeans.version}</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.netbeans.modules</groupId>
        <artifactId>org-netbeans-core-windows</artifactId>
        <version>${netbeans.version}</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.netbeans.modules</groupId>
        <artifactId>org-netbeans-core-ui</artifactId>
        <version>${netbeans.version}</version>
        <type>jar</type>
    </dependency>
</dependencies>

That pulls in a bunch of transitive dependencies, shown below:


Now, when you run the NetBeans Platform application, you see the main window, menubar, toolbar, etc.

That means that the answer to the question "what is the minimum number of dependencies for a GUI application on the NetBeans Platform?" is: 30.

About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« July 2014 »
SunMonTueWedThuFriSat
  
13
17
19
20
  
       
Today