Java Gui Frameworks. What to Choose? Swing, Swt, Awt, Swingx, Jgoodies, Javafx, Apache Pivot

Visual GUI Designer for Apache Pivot

I've been searching around a GUI designer for Pivot and it looks like developers just use XML editors when editing BXML. That being said, I did run across Geertjan's blog of an initial GUI designer for NetBeans called NB-PIVOT. I don't know how active this project is. But it's a start.

Is there any alternative of swing?

Try Java FX. It will give you better performance than java Swing. Java FX

Regarding bulding gui and widgets in java

What i needed was some good libraries in java to assist me in this process ( the clock widget and subsequently more complex gui). So i thought of getting libraries from jgoodies, the free ones.

Probably you don't need libraries as much as you think you do. Learn stuff from first principles and you will learn it better.

All the major Java GUI frameworks are quite high level and functional already. When you are first starting out, I think you should skip 3rd party libraries and see how far you get with what is provided in the base JRE and the framework of your choice. There is more than enough to learn with just the basic frameworks, the java language and the JRE. If you try to add in other frameworks too early, you will end up overloaded, confused and less productive. Plus the increased abstraction of the libraries may prevent you from learning some of the important underlying principles well enough.

Once you get a bit more experience in building things, then you will have a much better idea where the gaps in the frameworks are for your application and you can add in 3rd party libraries at that time.

planning to make a simple clock widget

If you get stuck, here is code for a JavaFX clock: How to draw a clock with JavaFX 2? or a similar implementation in Swing.

Note that creating a clock is quite a bit different than creating a traditional form based GUI that makes use of a library of predefined controls - but any of the major Java GUI frameworks can handle both tasks.

Don't make a clock your first GUI programming task, do something easier. Then try to create a clock later.

using swing for precise layout is really a difficult job

There are interactive graphical layout managers for Swing and other frameworks (e.g. the excellent SceneBuilder for JavaFX) which make this easier.

However, when first starting, it's probably worth hand coding stuff rather than letting a tool manage the layout for you (for example when learning JavaFX, stick with just the Java API and don't use FXML until you are completely comfortable with the Java API). You will learn the ins and outs of layout management and other things better that way. Sure you will make some mistakes and there will be a bit of frustration, but things will become clear in time with some persistence. And you may eventually end up deciding that you prefer hand-coding rather than using a graphical tool anyway.

The tricky part is usually creating quality, dynamically resizable GUIs that look good at different resolutions and window sizes - and that is generally tricky for beginners no matter what GUI toolkit is used.

The layout managers in JavaFX are very similar to the basic layout managers in Swing - so layout-wise there is little difference between the two frameworks.

The retained mode Scene Graph in JavaFX may be a bit easier to work with than the direct mode painting of Swing, but I guess that is not quite layout related.

Introspection tools, such as ScenicView for JavaFX, ease debugging layouts at runtime. Think of things like ScenicView as something similar to Firebug for HTML (e.g. your essential layout debugging companion).

And now i am utterly confused and messed up on what to do and dont understand anything.

You understand more than you think you do or you wouldn't have known enough to ask this question.

What you should do (IMO) is just pick a Java GUI framework (any framework - they are all passable), pick a decent starting task (something that seems mind-numbingly simple - even simpler than a clock) and start coding. Make everything task related; very small tasks with clear end-goals. Write a decent amount of code and always go back and revise your code and it's output to try to make it the very best it can be - don't settle for good enough.

Try painting rainbows and happy faces - when you code that up and see it on the screen, you will feel good about yourself :-)

If you need a refresher on the Java language, follow the Oracle Learning the Java Language trail. That trail is the way I learnt Java many years ago. It has been maintained over the years so that it is still a great resource and useful today.

If you choose Swing, follow the starting links from MadProgrammer.

If you choose JavaFX, follow the JavaFX tutorials and the Ensemble sample app but be aware that some of the JavaFX tutorials are targeted to more experienced programmers.

org.eclipse.swt.widgets vs. javax.swing.table: Why redefine it?

That depends on which framework you want to use. AWT/Swing and SWT are the two main frameworks for developing desktop apps in Java.

There is a good question about which one to choose here.

So the answer seems to be: You will have to choose one of them (Swing or SWT), since you really don't want to mix them unless absolutely necessary.

What is the difference between the Java awt package, Javafx, and Java Swing

Java awt is the first generation, Java Swing is the second generation and the JavaFx is the third generation UI-Toolkit for designing and implementing Graphical User Interfaces with Java.

If you want to learn more about these APIs and the other related APIs, you did not mention, please read the discussion here and there is also a video about the differences between these three APIs here.

Swing vs JavaFx for desktop applications

What will be cleaner and easier to maintain?

All things being equal, probably JavaFX - the API is much more consistent across components. However, this depends much more on how the code is written rather than what library is used to write it.

And what will be faster to build from scratch?

Highly dependent on what you're building. Swing has more components around for it (3rd party as well as built in) and not all of them have made their way to the newer JavaFX platform yet, so there may be a certain amount of re-inventing the wheel if you need something a bit custom. On the other hand, if you want to do transitions / animations / video stuff then this is orders of magnitude easier in FX.

One other thing to bear in mind is (perhaps) look and feel. If you absolutely must have the default system look and feel, then JavaFX (at present) can't provide this. Not a big must have for me (I prefer the default FX look anyway) but I'm aware some policies mandate a restriction to system styles.

Personally, I see JavaFX as the "up and coming" UI library that's not quite there yet (but more than usable), and Swing as the borderline-legacy UI library that's fully featured and supported for the moment, but probably won't be so much in the years to come (and therefore chances are FX will overtake it at some point.)

org.eclipse.swt.widgets vs. javax.swing.table: Why redefine it?

That depends on which framework you want to use. AWT/Swing and SWT are the two main frameworks for developing desktop apps in Java.

There is a good question about which one to choose here.

So the answer seems to be: You will have to choose one of them (Swing or SWT), since you really don't want to mix them unless absolutely necessary.



Related Topics



Leave a reply



Submit