Extending Java / RAD Support with NetBeans

In This Posting, I wrote that Java / RAD – ie Swing – Support could be added to the free version of Eclipse.

Well as a follow-up, I just wanted to mention that the Window Builder that this procedure installed, is not extensible. This can be quite limiting.

Instead, a better approach might be to install “Net Beans“, even under Linux. This IDE will support OpenJDK 7. We do need to make sure though, that we do not only have the JRE package installed, but also the JDK (development) package. It is a bit harder to set up than the other one, but has as advantage a Component Palette which is extensible.

After installing Net Beans, the thing to do is to add some sort of standard, built-in Swing component, thereby making the Component Palette visible in the IDE. We have our Swing Designer at that point. Then, under Linux, it is possible to add the Jar File ‘/usr/share/java/swingx.jar‘ to Net Beans, by way of ‘Tools -> Libraries (Global Libraries)’. Then, we can right-click on the Project and click on ‘Properties -> Libraries’, and add the newly-defined Library to the Project.

Next, we can right-click on the component palette, and open the Palette Manager, from which we first create a new Component Category. It will be empty. Then, still within the Palette Manager, we can add components at will From the newly defined Library. It will ask us which Category to add them to, and presumably we would add them to the Category we just created.

And at that point we will see, that we not only have components such as “JPanel”, but that we potentially have a large number of components, whose names begin with “JX”, such as “JXPanel” …


 

I never really knew, that Net Beans was so powerful, yet free. However, Net Beans is not open source, and to install it, we need to run their SH File as ‘root’. This could present a daunting leap of trust for some people. Also, even though this setup script wants to be run in root mode, it will also need to display a graphical wizard. This requirement has led to a common but minor error message with many users. And so, in user mode, we need to give the command ‘xhost +‘ first, so that the root-mode process can access our X-server, and then after we have installed Net Beans, back in user mode, we give the command ‘xhost -‘ again.

Even though we are allowed, just to add one JAR File to the project, by right-clicking the project and then clicking ‘Properties -> Libraries’, I am thinking that maybe a better way to manage this, is to click on the IDE Menu ‘Tools -> Libraries’, to create a New Global Library which will at first be empty, let us say with the name ‘SwingX’, and then to add the JAR File in question to this new global library. After that has been defined, it will be slightly easier just to add the capability to our project, as well as to the Palette Manager, as a Library, instead of always having to navigate to the JAR File in question through our file system.

In theory, if we had a JAR File which depended on another, defining a Global Library according to Net Beans in this way could manage that dependency. But in practice, none of the JAR Files which I have installed using my Linux package manager, that do implement the Swing interface, have stacked dependencies in this way. I am sure however, that eventually we would be able to find JAR Files that have such.

However, I have some JAR Files installed on my system, which have bindings to non-Java libraries. Those would eventually pose an issue, when deploying the Java application. Yet, because mine is a properly-managed installation, these non-Java, SO Library Files are also segregated into the directory ‘/usr/lib/jni‘.

 

Dirk

 

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *

Please Prove You Are Not A Robot *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>