There are a lot of Java "application frameworks" such as those listed in http://pivot.apache.org/demos/ which pretty much all use Swing as the GUI toolkit, or in the case of Eclipse, SWT.
However I have not seen any obvious frameworks for JavaFX. Why is this?
If looking at the "Hollywood Principle", where the framework calls you, I would think JavaFX already does this, but then I'm confused because it would seem Swing and JavaFX do mostly the same role, which is as the GUI layer. But they both do event loops and callbacks/events/observer patterns, etc.
Does merely implementing an event loop and calling your event handler not qualify as an "application framework"?
If not, are there any frameworks based on JavaFX directly (rather than embedding JavaFX in a Swing control)? What would such a framework provide that JavaFX standalone does not?
Sorry for the "obviousness" of this question, but it's not obvious to me.
thanks.
There are plenty of them looks like your research has not been very thorough
http://efxclipse.org/ - in fact it leverages the same core stuff than the Eclipse 4 IDE / RCP 4 but replaces the SWT layer with JavaFX
http://www.jrebirth.org/
http://www.drombler.org/drombler-fx/
http://jacpfx.org/
As I'm the author of e(fx)clipse I'm biased but I know first hand that it is used on (big) commercial projects
In my opinion, Swing, JavaFX and also SWT are graphical toolkit, providing a set of basic widgets. There are not "Application" frameworks because their main goal is to display an User Interface. But you can use them to build an application without any other library by using basic features.
A good sample application can be found here: https://github.com/angelicalleite/museuid
It looks really nice with data picked from a mysql database, but if you read carefully the source code you can notice that all SQL queries are performed within the UI thread which will slow down the UI responsiveness.
This is one of the reason you should use an Application Framework.
Their goals vary and are numerous but they all are dedicated to ease your application development by keeping complex things (like multithreading, messaging) out of your application code.
Your choice shall be done according to your personal convictions about architecture and dependencies you want to use (or don't).
I'm the author of JRebirth (disclaimer), but I sometimes have a look on other frameworks, so you can make your choice by asking yourself some basic questions:
Do you want/need OSGI support ?
=> Yes efxclipse, DromblerFX, DEMUX
=> No JRebirth,JacpFX, DataFX, griffonFX, afterburner.fx
Do you want a minimalist framework?
=> Yes afterburner.fx
Do you want/need event messaging?
Do you want to share code?
Do you want modularization?
Do you require Java 7 support ?
How do you want to manage your application threads.
I certainly forget a lot of questions.
In fact you SHOULD use one of these Application Framework (building your own will be time-consuming), it will defintely speed up your developments and secure them, the remaining questions are :
What AF will fit your needs ?
What AF will be convenient to use for you and your team ?
Choosing an AF using patterns you don't like could be painful, in any case you can contribute to any available AF because they are all open sourced.
Hope it helps,
The simple answer to this is: JavaFX is much younger than Swing - at least as a standard JDK library. As a matter of fact, it only became a "real" standard part with Java 8. If you check the history, you see the following facts:
Before JavaFX 2 (released 2011), developers needed to learn a scripting language.
Also before JavaFX 2, the implementation aimed at being platform independent and therefore made no use of system-specific resources which can make a big difference in graphics and animation.
Read through it, and you'll find some more interesting details which can be summed up in that probably most developers have only been "seriously" noticing JavaFX within the last 5 years or so. Swing goes back much further (especially as being baked into the standard Java Runtime Environment), so naturally there are far more libraries aimed at Swing than at FX.
I've been away from Java programming (except some Android dev) and desktop apps but now I want to develop a Java desktop app as a personal project. So I wonder, what's the current blueprint for this kind of app? Is still Swing and JDBC?
Having said that, would also recommend that set of technologies for a simple project? As an analogy, I don't want to read a 800 pages book on J2EE just to do a simple web page, if you know what I mean.
Thanks
Do a little prototyping and choose:
Swing: Most resources, most used, lot of 3rd party free stuff (SwingX etc.), kick ass look and feels, really cross platform, nice IDE support. Swing is going to be improved in next JDK release, so it's still pretty much in game. NetBeans IDE and IntelliJ IDEA are written in Swing.
SWT: Alternative which uses facilities of operating systems on which it is implemented. SWT community is smaller and it doesn't provide that many tools as Swing does. It's a little more tricky to do cross platform, you need to make actual comiplation on all OS you are going to ship your app on. Eclipse IDE is written in SWT.
QT: Cross platform solution with lots of users. It's pretty popular amongst C++ users. On the other hand, I've never seen powerful tools for Java+QT as for Swing or SWT. I don't consider QT as "true Java" solution, but you might have different idea.
Java FX : Since 2007, Sun tries to persuade us to use this declarative approach for building RIA. I've seen lots of tutorials but I never liked Java FX and I am not alone at all. JavaFX tries to be only UI solution, it does NOT replace Swing.
There is probably much more, but this is what I tried. From those, I liked Swing. It's pretty mature now. There are bazillion of tutorials over here. Yes, some things are pretty painful with Swing, but overally I think it's still best desktop choice for Java.
Another intersting thing, if you're into declarative UI, is YAML. Check this pdf book.
As for second part, JDBC is still pretty popular, but you might think of some ORM framework (you can easily google some or looke here on stackoverflow, most popular one is Hibernate).
After spending a lot of time and code on programming in Swing, I thought this can't be state-of-the-art Java GUI building. After not finding a user-friendly visual gui bilder for eclipse I stumbled upon declarative GUI building with XML UI toolkits... and I thought: This must be it! I think it's the right way to go, easy and also close to web-programming.
But after looking around in the web and on SO, I got the impression that it is not very common! Although there are many implementations and APIs, it seems like most of them are kind of dead and had no updates in the last 5 years..
So I wonder: Is my feeling right, that XML is not very widespread for java GUIs? And if so - what are the reasons? Maybe it couldn't become accepted or it has some major drawbacks or people are doing everything in the web instead with fatclients or there are better alternatives, maybe javafx?
I just need to know if it is worth spending time in that area or better look for alternate ways. As I dont read developer magazines I just don't know what the trends in gui building are and which technologies are believed to have a future. But I can't imagine that people still spend so much time on writing nasty swing (or swt) apps.
There new fresh and interesting approach - it uses YAML. Check it out at http://code.google.com/p/javabuilders/
Sun's answer to that seems to be JavaFX.
It has a declarative language for specifying the GUI and there will be builder apps as well.
There is some prototype work going on for e4 (Eclipse 4), which would allow building a GUI by editing an Ecore model and customizing it via CSS.
See this blog post for some details and instructions to try it out yourself.
Five to ten years ago XML was very popular. Although fine to provide some kind of standardisation for transferring data between heterogeneous systems, it's not suitable for programming. It always starts with the easy stuff, and lets declare everything. But any real system requires code. XML then falls down. There is also the problem that XML is a bad syntax for humans, and even languages like Java are easier to read.
On the other hand, there is clearly a need for the rails of GUIs. Naked Objects is the closest reasonable attempt I have seen.
I came to the same conclusions as you about the declarative frameworks out there. It is not worth learning a new GUI syntax unless it's widely supported. XUL as an interface language is widespread, but there is no java rendering framework for it. I'd say HTML+CSS+Javascript and a Servlet container is the best Java platform for GUIs today, but sadly I haven't found a platform independent way to display web pages like a desktop application.
If you use Eclipse, you can now use WindowBuilder to help you in creating Swing apps in a user-friendly visual GUI builder. It's now available as a free download, and Google has donated the Swing GUI builder framework to the Eclipse Foundation.
I'd second Thilos suggestion with javaFX.
Additionally the trend is pointing to webapps, so I think that in the long run javaFX and web based UIs will catch up to swing+swt GUIs.
I do all my swing stuff by hand and none of my application is nasty. If you do not know how to create usable and good looking UI there is no technology to help you.
The answer is surely not going to be XML. What problem are you trying to solve? You want to have reusable building blocks, and a compact way of describing them. I don't see XML helping you there.
[edit] Creating a java code equivalent of XUL would be an immense improvement on XUL.
XML makes it really, really hard to do good separation of concerns and once and only once. It is however perfect for the mongolian horde approach. You need a layer on top of swing, it only provides the building blocks.
Obviously the Java API reference, but what else is there that you all use?
I've been doing web development my entire career. Lately I've been messing around a lot with Groovy and I've decided to do a small application in Griffon just to experiment more with Groovy and also break some ground in desktop development. The only thing is I'm totally green when it comes to desktop apps.
So, world, where's a good place to start?
The Swing Tutorial is very good. Apart from that, the Swing API is obviously the reference, however it's also a treasure trove of fairly good source code! Add the API source to your IDE and you can jump directly to the implementation to all the Swing classes. This is a great way to explore the functionality, see how various Swing components work and learn a good Swing "style". Furthermore, it's great to be able to step through the API classes if things don't seem to work and you have no idea why! Adding the API source to the IDE has the additional benefit that you get all the JavaDocs along with it, although all modern IDEs can also pull them from the net -- you do not want to program desktop Java without the documentation available from within the IDE!
NetBeans and other IDEs do make the creation of IDEs very easy, but be aware that there is a lot more to Swing than just containers and layout managers. In fact, containers and layout managers are among the easier things, and I'd recommend learning to use them by hand, too. There is nothing at all wrong with using a GUI builder, but in some cases it's overkill, and then it's nicer to just quickly whip up a GUI from source. In other cases you need to be able to create a GUI dynamically and then GUI builders are no use at all! For creating very complex layouts from source, I recommend FormLayout, which has its own set of quirks, but which does scale (in terms of programming effort) to very big frames and layouts.
If you've only done Groovy so far, you'll be surprised how well documented Swing and the rest of the Java API is and how well everything is integrated. It might also take some getting used to a different style of programming, using the debugger more often and println-debugging less, etc. There might also be some "boiler-plate" code that will be very annoying. ;) Enjoy.
The Sun Java tutorials are pretty good. I cannot vouch specifically for the Swing one as it has been ages since I've done any Swing development and I have not read it myself.
Creating a GUI with JFC/Swing
When it comes to developing java desktop applications, I would highly recommend using the IDE environment Netbeans. Especially when it comes to the development of Swing based applications.
I recommend you to play around with netbeans. It will allow you to build complete GUIs using only your mouse. Once you get familiar with Swing components, start using the Java API. Thats how I started.
The O'Reilly Swing Book is a pretty good reference, it has a good overview of general Swing concepts and covers each of the major classes. I used it recently when I had to refresh my memory on Swing.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Is there any IDE that simplifies creating Swing applications (ideally something along the lines of Visual Studio)
Like others have mentioned, NetBeans' visual editor is pretty good, but it's based pretty heavily on the Swing Application Framework, so you'd need to get an understanding of how it works to properly use it (although you don't need to dig in to just test things).
Other than that there are also:
the IntelliJ IDEA visual editor (flash demo of the features)
and Eclipse's Visual Editor
Personally I've used NetBeans' and IDEA's visual editors. Both are nice, but I thought NetBeans had a leg up, because it doesn't use any proprietary way of saving the GUI structure and instead does something similar to what Visual Studio does - auto-generating the code that you can then add to. IDEA stores the information in a separate file which means you have to use IDEA to edit the layout visually later.
I have not used Eclipse's Visual Editor.
My vote is for NetBeans' visual editor. I think it satisfies what most people are looking for in a visual editor and leaves it flexible enough to plug the holes manually through code without affecting the visual editor (so you can switch back and forth between code and design views without breaking either).
I like the Swing GUI Builder from the NetBeans IDE.
For me, the best visual Swing editor is JFormDesigner, which you can run standalone or as a plugin for IntelliJ IDEA and Eclipse.
It generates proper (actually readable) source code, it's very ergonomic and intuitive and, above all, very extensible. That last point is really important, because if you want to build a decent Swing application, you'll have to extend the base components or use some third-party libraries and it must be easy to integrate those in the visual editor.
It's not free, but it's a bargain for the power you get (129 EUR / 159 USD). I've been using it for a few years and love it.
There are two that you can use (I've used them both, and they are both very powerful, and easy to use):
NetBeans which has a built in GUI Builder.
Or you can use:
Eclipse with the Windowbuilder plugin
(it can be downloaded here and here)
Personally, I prefer Eclipse with Windowbuilder, but that's just me. You can use either one.
Here is a picture of the Windowbuilder plugin:
And here is a picture of NetBeans' built in GUI Builder:
Netbeans has some GUI-building support, and it's one of the most popular Java IDEs on the market. Give it a look.
Try Instantiations' Windows Builder Pro. It includes Swing Designer, which is a Swing UI builder. It is based on Eclipse.
Abeille is very good and is based on the JGoodies FormLayout. Unlike almost every other Java GUI builder, Abeille does not generate code by default. In the project I used it on, it was wonderful to avoid reading or scrolling through the layout code (because that code no longer existed). Most of our hand-written code concerned itself with connecting events to actions, simply asking the layout for the relevant controls.
It's a crime that code generation is the default way to layout code in Java because better ways of doing GUIs have been around for decades. I have used Matisse, the NetBeans GUI code generator. While Matisse (now known as "Swing GUI Builder") makes it pleasant to layout components, it is similar to all other code generation tools because when you use Matisse you must live in constant fear that someone else edited the "you cannot edit this in NetBeans" GUI sections outside of NetBeans. As soon as you touch the layout builder again it could destroy their work and then you have a broken GUI. There might be some simple task like re-ordering a variable initialization and its use or re-naming a variable (this was especially a problem when using Matisse's database feature). You know how to do this by editing the un-editable source code but may waste time trying to figure out how to do the same thing in the GUI builder. Like most code generation tools, it might get you started, but eventually you will have to maintain the generated code yourself.
WindowBuilder Pro for Eclipse
Free!
It works with existing code and doesn't lock you in (as opposed to NetBeans)
It works with MiGLayout
It does have some conventions that your view classes have to follow, though.
Installing in Eclipse v4.2 (Juno):
Goto - menu Help → Install New Software...
Select - Work With: Juno - http://download.eclipse.org/releases/juno.
The WindowBuilder items are under "General Purpose Tools" (or use the filter).
Older versions and zips are available at http://www.eclipse.org/windowbuilder/download.php.
The latest version of NetBeans include a very nice and simple visual editor for Swing called Matisse
Matisse
I have a very good experience with NetBeans. It's so easy if you know every minor parts of these applications.
The most complicated part is using, for example, the layouts (if you can not handle complicated parts), but everything is almost plug & play.
And in addition, you can put JFrame into other frames without creating another frame class for this. I think that will be good.
I recommend WindowBuilder plugin for Eclipse IDE 3.7.2 Indigo / 24 February 2012.
Here's for the step-by-step installation: Create Java GUI as Easy as Visual Basic
NetBeans is the simplest to use (http://netbeans.org/). However, it does not allow you to edit (fine tune) the generated code.
JDeveloper (http://www.oracle.com/technetwork/developer-tools/jdev/overview/index.html) is another solution and does allow you to edit the code... but I feel NetBeans is more intuitive.
Frankly, I've never seen an editor which comes even close to what I can do manually in a text editor. All the visual editors are nice if you only have very simple needs like putting a few buttons in a window. When things become more complex, visual editors quickly loose their competitive edge.
I usually use a bunch of high-level classes built from more basic widgets and wire my UI from that. This also allows me to easily test my UI with automated JUnit tests (because I can control what the source looks like).
Lastly, changes to the UI won't generate unnecessary noise in the version control system.
Eclipse Visual Editor is pretty dull in my experience. I had more luck with JBuilder, which is also based on Eclipse, simply adding a few plugins to it as many other commercial products do. It is still not able to parse any Swing code (I doubt any Swing WISIWYG editor does), but if you start with it, it gives you relatively seamless experience.
You need to pay for it though.
At the end of the day, I have worked with different similar UI tools, Flash Builder, Delphi etc., but unless you do some relatively trivial UI design, not including much business logic and communication with other layers, you'll have to accept that what you are capable of creating in code once you learn to do it properly is much more powerful than what any editor is capable of providing you with.
I have switched between several IDEs and the one that I believe has the best GUI builder in terms of use and performance would have to be NetBeans.
I have tried a few and the closest I have found that comes close to Visual Studio is NetBeans. Version 6.5 is excellent and really improved over version 5.
I'm a big fan of JetBrains, and when it comes to Java, IntelliJ is the best IDE I have used.
For Swing, they have a fully interactive UI builder. And, for actual coding, their intellisense can't be beat.
JFormDesigner.
I used NetBeans extensively in the past for GUI design, but I am now using IntelliJ with the JFormDesigner plugin. I have tried several other solutions, and this is the one I am sticking with.
JFormDesigner also works with JBuilder and Eclipse, so you are not locking your projects to one particular IDE.
Of course you should use NetBeans for building a Java Swing GUI. The drag and drop features and auto-code generation are quite mature.
For Eclipse, I am not sure. But because IBM has its own SWT package for GUI, I am not sure whether it support Swing.
I used to use MyEclipse quite a bit. It had a decent IDE for making Swing forms and such. I assume it has improved in the past year - they seem to add features in gobs and heaps, quite often.
http://www.myeclipseide.com/
Use NetBeans, I have also successfully developed one application using NetBeans.
It is realy awesome, it helps you while writing the code.
Since Swing generates some code on its own so it is really helpful to use Netbeans.
Go through it and you can always ask question and problems.
It will be good if you go for latest version release.
I have always coded my UIs by hand. The frustration of dealing with screen builders and filling out all those property sheets is too much for me. After a couple of screens and a little research I am just as productive.
As I'm using Eclipse, I use the Visual Editor plugin. It generates clean source code, with good patterns and easy to patch/modify/extend.
Unfortunately, it is not very stable. But it's worth trying.
I like Eclipse's VisualEditor (VE), and sometime ago I've tried to switch to
another editor, but I found it impossible. Visual editor has this
feature that it generates manageable, readable, editable, and easy-to-understand code.
Unlike both mentioned earlier NetBeans editor and WindowBuilder it uses the lazy initialization pattern to separate initialization of components. Also it does not need to lock down parts of code that you can't edit; you may edit code by hand, and VE is still able to work with your changes.
The only disadvantage of VE is that it uses Eclipse v3.2 (Callisto) (there is no official build for Eclipse v3.4 (Ganymede), or Eclipse v3.3 (Europa)), so effectively you have to use two Eclipses instances, one for VE and one for the rest of the development.
I took it from recent discussion on comp.lang.java.gui (I was the author of this post, so I could do it rightfully). Here is the link to the whole discussion.
We have been doing Swing development for nearly the past 10 years. There are some nice GUI builders available (e.g. JFormDesigner), but all restrict us too much in different kinds.
For example, we have a lot of components without public no-arg constructor (e.g. a JTable subclass which requires the model in the constructor) or we have component factories.
Desktop applications usually have to be obfuscated. Obfuscation very easily breaks user interfaces created with a GUI designer or requires much work to avoid obfuscating such classes.
Another often happening case is that, for example, a panel should only contain some components depending on some condition. Simply hiding them would make the GUI look bad; they rather should not be added instead. I never found a GUI editor which provides this flexibility and even if there would be one, it would be so hard to use, that I definitely would be faster with good old Java code.
I think the best editor that can exist is Visual editor for Eclipse.
The only drawback is the fact that we can't re-edit the visual part when we modified the source code. I hope one day we will have a tool that rivals Visual Studio in this aspect.
I have not used anything other than NetBeans for Swing, but I have been extremely happy with it. I used it for 18 months on a $25M application and to develop an prototype application to replace a Windows Forms app.
Up and until Microsoft came out with WPF, in my opinion, there was not a better tool kit for traditional desktop applications. (I always found Windows Forms too limiting).
I personally will suggest NetBeans Swing Builder. Yet, if you want total control and to gain an in-depth understanding of the Swing framework, I have noticed doing it free hand is the ultimate choice.
window builder pro is good option and it is free also.
As others have mentioned, my best experience with Java SWING applications is with NetBeans. NetBeans has a WYSIWYG editor, and the code is automatically generated for you, which is then protected, however you can add custom code to add listeners and other events that the end user may be interested in using, such as buttons, text forms and areas, and other nice GUI tools.