Related
Similar questions to this are asked periodically, but many of these answers are outdated.
I need to build a cross-platform desktop application in Java with a GUI of comparable quality to contemporary desktop apps.
Swing is the default choice, but I have yet to encounter a Swing application that didn't look, at the very least, quite dated and clunky (subjective, I know, but with GUIs it's hard to avoid aesthetic judgements).
I notice that the new Bitcoin client now uses QT with Java bindings, and does have an attractive user interface, but this has the disadvantage that it is no-longer pure Java.
So much of what I find when I search for Swing-related libraries is 5 years old or older, even though the aesthetics of desktop applications have evolved significantly since then.
If you needed to build a Java desktop application from scratch, what would you use for its GUI?
I can also offer you a new LaF to look into - WebLaF. I'am currently working on it to bring a lot of UI features and make work with Swing much easier for anyone by just using WebLaF library basic features.
A few examples showing how some of WebLaF components look like:
Some of main goals i am targeting:
Great and modern-looking L&F with support for all Swing components
An extensive set of additional components which you won't find in standard Swing
A big set of Utility classes to assist you with writing the code
WebLaF library also suggests a few other advantages and unique features:
It is an open-source project (GPLv3 licensed)
Easy components styling using painters system (specifically with 9-patch files)
Quick and easy customization of the default "Web" style
Lots of features to accelerate and simplify Swing application interface creation
You can try the demo-app to see if it is modern and simple enough :)
Have you looked into JavaFX 2.0? It is designed to interop easily with Swing, and has many modern 'good looking' controls.
Also, as lrAndroid mentions, a Swing app can look like a native app if you set the system look and feel with:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Look into changing the Look and Feel of your Java program. This allows you to customize the overall "theme" of your program.
Here is information on changing the LAF.
I've had good experiences with FlatLaf.
It's easy to install, it's cross-platform, it has no external dependency, it's open-source (Apache license), it includes dark modes and there are tons of themes.
After adding :
UIManager.setLookAndFeel( new FlatLightLaf() );
your app looks like it was written during the last decade, and not during the previous millenium.
It also has one high-contrast theme, for accessibility.
Modern Javascript frameworks (ExtJS, Dojo, etc...) offer the same widgets richness or more (Excel like grids for instance), a wider variety of L&F and usually fit better with the OS of the user.
Users are also very comfortable with their browsers and, hey, "modern stuff" is on the web, and the modern web today is HTML+Javascript.
The overhead of converting an app to "web like" is minimal. An embedded Jetty can remain really small and disk space has become much less of an issue.
There are additional benefits going down this route for the future evolutions of the application.
Suddenly, the desktop app becomes a server app, which can be accessed from another desktop. We were able top promote a desktop app to 'portal' in a matter of weeks.
Rewriting the app in terms of (Ajax) web services provides an easy transition to creating a full REST (or SOAP...) services stack. The app can then be integrated to other applications, easily monitored externally, etc...
Support of other devices (smart phones, tablets,...) becomes much easier, by concentrating on the UI layer only
As the app grows, separation of concerns is cleaner; developers working on the UI do not have to mess with low level code.
There are a lot of excellent JS/HTML designers and developers that do not program in Java.
EDIT
3 years later this has become extremely easy thanks to Electron
Try one of these:
JTattoo
JGoodies
Quaqua
What about Nimbus look and feel? Oracle Link
Also take a look at SO-Question
I know this question is old, but if you don't want to use FX and still want to use Swing, then try MacWidgets, i've used it on a couple projects. It's very light, and looks great. Below is an old project i was working on, over time i've perfected using macwidgets and now use it internally in my company.
http://www.digitalhand.net/projects/jdataanalyzer/mainGUI.png
QT is quite extensive but also very big (bloated) and complex. There is also the SWT library being used by open office for instance. SWT uses native UI widgets for buttons, tables etc where as Swing emulates them.
However, the trend is clearly towards writing rich client applications for the browser using HTML and Javascript. Both of these have made huge strides in the past few years.
HTML5 specifically targets rich client applications with features such as better forms and local database to support disconnected scenarios (note that this last feature is not standardized yet but it is implemented by all latest browsers).
Javascript has now powerful libraries with jQuery and its many plugins. There are even languages like Coffeescript which can be used to produce Javascript with a simpler and more powerful syntax.
There's also no need for such apps to connect to an outside server. Small footprint local servers (eg: jetty, node.js, ...) and databases (SQLite, H2,...) can be installed on the client to make a completely self contained application.
Swing is good (stable, documented, supported until 2026). The problem is that it relies on the LookAndFeel system that provide a very limited number of boilerplate choices. It should be easy to change the appearance of each component individually and then unleash its creativity. Unfortunately it is painful. IMHO frameworks should be built on top of Swing to make it possible instead of creating JavaFX.
Take a look at https://github.com/dotxyteam/ReflectionUI.
Ex GUI: http://javacollection.net/reflectionui/wp-content/uploads/2017/08/general.png
Go for Jetpack Compose for Desktop. It's a super modern reactive UI which is nice to work with. It also works the same as it would for Android with very few exceptions. It's Kotlin though instead of Java, but these are both JVM based and it's very easy to make the jump.
Thanks for your answers to my previous question about GUI in java. I now wonder what are the solutions chosen by professionals to get a nice GUI, for "real" applications. Do you use swing and JComponents and just change the "look and feel" ? Do you prefer awt or another library ?
Sorry if that question sounds weird, I'm a student and I don't really know how java is used in the real world...
In our company we use Swing, as that is supported by the JVM out of the box, but we do use color coded background colors for some panels and buttons.
If we'd use something different, like SWT or Jambi we'd also have to roll out those frameworks for all platforms, and test those frameworks for all OSses and (supported) java versions. Not nice at all.
It is however fairly tricky to create a nice responsive application with Swing; so you really need to use SwingWorker and the like. With a bit of experience however you can create a nice application that way.
And even if it isn't the fastest framework to develop in, development time is really small compared to defining the functional requirements of the user interface, and testing and support when the version is released.
That said, our target is desktops. If you target mobile devices or also need a web frontend your choices may vary.
I don't believe anyone prefers AWT anymore. Swing supplanted it entirely eleven years ago, building on top of it to correct flaws in the AWT 1.0 design.
Swing isn't the only way that professionals make Java UIs. That works for desktops, but there's also JavaFX now. For the web, UIs are built using HTML, CSS, JavaScript, and JSPs.
My experience is that most organizations that want to create rich GUIs still use Swing, and manually go through all the annoyances of layout managers, etc.
The use of SWT is fairly limited to organizations that are using the Eclipse RCP as their platform. I'm not sure why it hasn't caught on outside this platform.
It's sad to admit, but Java Swing GUIs don't generally look good unless you spend a lot of time creating a more native feel for them. Even then, they often lose out on aesthetics to equivalent programs written specifically for Windows and which use Window APIs like WinForms.
The most decent Apps I saw in the last years were build using Eclipse Rich Client Platform
Eclipse uses the Standard Widget Toolkit
and provides Graphical Editing Framework (GEF)
We typically use Swing becuse it's supported in standard JREs out of the box. Normally we do the initial form design and event hookup in Netbeans and then export it to whatever we wish, Eclipse, for example.
Netbeans spits out pure Java using standard libraries (plus a jar or two you have to include) so it's no big deal designing the form in Netbeans and later moving on to something else.
Some people suggested doing form layout by hand using a layout manager. I see that as an option only if you are doing something big and very well budgeted that has to be maintained ad infinitum. Otherwise it's just too time consuming to be worth it.
We rely on SWT for our Java GUIs. Yes, you have to include an external native library, but the look and feel is native, more responsive (although Swing has become much faster in the past few years) and seamless with other apps on the target platform.
Macintosh OS X creates their own Java runtime. They give Swing components the same look and feel as native applications.
I use strictly Swing. I distribute "real" desktop applications via Web Start for both Mac and Windows that interface with the user's smart card reader.
The NetBeans IDE gives you a WYSIWYG way to create your forms. I've tried it out, and it's pretty neat, but we still use Eclipse as our IDE and design the forms in code.
I need to create a GUI application in Java. I just realized that I have different optional ways to go (SWT and Swing are among them).
I have already found out that there is a lot of discussions about what way is better and I do not want to go to deep into these discussions (I am a newbie).
I do not care about all aspects of the dilemma. I just have a few main requirements listed bellow:
It should be easy to use (easy to create what I want).
In the end I would like to have just one file which can be easily executed (without any additional tricks, settings and installations) like a standalone application.
It should be platform independent. Or more specifically, the application should work fine on Microsoft-Windows and Ubuntu (Linux).
Based on your requirements, I would say Swing. SWT has a more platform-specific look about it but Java ships with Swing built-in, there's no messing about with external libraries as with SWT although the use of Eclipse may make that much easier (I still develop quite a bit of my stuff from the command line unfortunately).
They're both easy in terms of use (well, easy once you get used to layout managers) and will work fine under both your desired platforms but since the only differentiator you seem to care about is the "without any additional tricks, settings and installations", I would stick with Swing.
That's my advice. Feel free to accept or ignore or even call me an old coot. I won't take offence :-)
I just completed a two year project creating a buisiness application, so my focus was clearly on usability and speed.
My decision in the end clearly led to SWT, for the following reasons:
Buisiness users tend to use Terminal Servers and RDP for their apps. Every Swing app is very slow over RDP, because the app has to render every pixel again and again. Try using Photoshop or Gimp over RDP and start scrolling in an image. That is the performance you have with Swing in tables.
Some very good gui components are only available as COM objects. I wanted to be able to use those, and since 100% of all buisiness customers are Windows users, they accept the fact that your software only runs on Windows. (We have linux clients, too, but only for machine input terminals, that don't need the full blown Windows GUIs)
We use SWTDesigner as a GUI designer, which is as good as SwingDesigner für Swing (which both are the best GUI designers at all). They are worth the price tag if you have to create a few hundred masks.
Our GUI looks 100% native, honors the large fonts they use on their desktops, and feels fast.
We are very satisfied with SWT, but it has some downsides:
Native Java components are a bit rare. There is more on the Swing side of life.
I would suggest that you use Java's Swing libraries if you are not familiar with Java GUI development. They are very well documented, and there are lots of tutorials on-line, including on Sun's Java website (here).
GUI development in Java is not very straightforward, but the tools available are getting better all the time. I would suggest you try out the NetBeans IDE that has a nice visual designer for GUI components. I have not used the Eclipse IDE's GUI designer, but I gather its good as well. You will need to get your head around the MVC pattern, but it should be a good learning experience.
In short, my vote goes for using Swing/JFC, especially if you are new to Java GUI development.
EDIT - You can control the look and feel of a Java APP very easily. If you use the platform independent (Metal) look and feel, your GUI will look pretty much identical on Windows and on Linux. Of course, a Java app will run just fine on Windows of *nux as long as there is a supported JVM installed.
I cannot add comment yet because I'm new here (please mod me up so I can comment) but choosing Swing or SWT depends on the IDE you're using.
If you're using Eclipse, then both are fine.
If you're using the free IntelliJ IDEA community edition, you'll prefer to use Swing because the IDE's GUI editor is "Swing only".
I take it you're using Eclipse?
Based on your requirements, I recommend using Swing:
SWT requires additional native libraries (violates item #2),
You are likely to find more instructional material on Swing (since you are a newbie),
Both solutions are somewhat platform independent and supported on both platform you mentioned but SWT is not equally supported on all platforms,
There are more WYSIWYG tools supporting Swing which may help with the learning curve.
Note that the APIs are similar and sometimes identical so learning one gives you a head start on the other.
I find Netbeans' drag and drop visual editor and pre-wired Swing Desktop Application template much easier to use that what comes bundled with Eclipse, so I'd suggest that.
It'll automatically create an executable jar, and let you create a Java Web Start launcher if you wish as well. And being Java, it's OS-independent.
Here's a link to the quickstart tutorials.
Swing,
SWT works on Ubuntu but not nearly as well as on Windows, that's at least my experience. The main reason to choose SWT is if you want to build your application on the Eclipse RCP framework( where you get a dockable views/editors, plugin mechanism, automatic updates, user roles. help browser, preference mechanism etc) or if you want your application to have that polished native look.
From my experience, if you want easy to develop Swing is the way to go. If you need good performance, then SWT is a better bet.
NOTE: The last time I did GUI development in Java was 4 years ago.
I want to know which is the best tool which can be used to make GUI . Currently I'm working on VC++ 6.0 and I can't give a good look(Vista Look) in that.
So can anyone help me which one will be more suitable for GUI .. Java or any other tool(.net WPF) and if you can give the reason then it is very helpful.
Thanks
I would recommend WPF .. It has the new markup language which suits well the UI development, supported by code behind.
Check some examples http://blog.trivadis.com/blogs/manuelmeyer/archive/2008/06/12/cool-wpf-samples.aspx
Java is designed to work well across multiple systems.
.NET underlies Windows.
If you're trying to imitate Vista's look and feel as closely as possible, go with the framework that was written by the same company that also made your operating system.
Any of the above are capable of a good "Vista" look (including VC++). You just need to opt-in to the new visual control styles with a manifest. WPF will have the most options for a "sexy" Windows UI, and won't need the manifest.
You can use WPF for serving your purpose. WPF lets you
edit the opacity of the elements : so that you can create transparency effect as in Vista
create storyboards for your animations
change the look and feel of existing controls using styles, so it can be easy to create Vista style controls
apply bitmap effects such as Outerglow, Dropshadow, etc.
Although WPF is not limited to the above features, but it is the partial list of features for which you can use WPF to achieve your desired effect.
If you do decide to go down the Java route, take a look at the JGoodies libraries. They take a lot of the pain out of writing Swing apps by providing (amongst other things) a much more usable layout manager, a data binding framework, and some some Windows like look & feels.
Take a look at this to see why you don't want to use one of Swing's standard layout managers directly...
Depends on what you mean by "best" tool.
In Java you are most likely looking at Swing to develop your application as far as frameworks go. If you are looking for a complete RCP, you could take a look at the Netbeans Platform or Eclipse RCP. The Netbeans IDE also has a nice GUI editor that can be used for generating Swing GUIs (if you don't mind working with generated code and the Netbeans IDE).
WPF is very nice but has quite a large learning curve.
Swing is a bit chunky.
7 years ago at least Delphi was a really really polished and good way to produce a windows GUI, since then Delphi has moved to be a .net laungage. So I would recommend at least looking into Delphi
The tool decision should follow your requirements.
Do you need a GUI for a stand-alone Application or a client-server architecture? If it's stand-alone, do you need it for a single operating system or you need it portable? If it's client-server, do you want a thin client ('webapplication') or a rich client, if it's a rich client, you want the user to install it or shall it be provided by a webservice?
Do you want to hardcode the GUI or declare it? Do you have some expert knowledge on a certain programming language or a certain framework or do you want to use the project to learn on or the other (or both)?
I think, it's much easier to recommend something when we have some more background information.
From the few things I know I suggest:
Upgrade your visual c++ environment and keep working with the tools and frameworks you already know. Microsoft products should be the best solutions to develop applications for Microsoft operating systems.
I would recommend Flex with Adobe AIR - it's nice! adobe flex
I'm developing a Java ME app & need pointers to some really good UI libraries. I did see a few such as Java ME Polish. Are there any more out there? For e.g. ebuddy's java ME app has an amazing UI and so is gmail's java ME app. What libraries would they have been using or would have they have developed it on their own?
Sun recently released and opensourced their solution to crappy looking lcdui. It is called LIghtweight UI Toolkit and can be found on lwuit.dev.java.net
We have been trying lately on kuix.. So far so good and more light weight than LWUIT
code.http://code.google.com/p/kuix
eSWT would be available for MIDlets on the latest J9 VM, as used by the Series60 3rd Edition feature Pack 2 handsets (Nokia N78, 6210, N96...) but we're mainly talking about nicer looking UI controls. Basically, a MIDlet can look much more like a native application now.
Sun has recently open-sourced LWUIT.That could also be worth a look.
Nothing beats drawing your own images on a Canvas,though. Generic layout managers in any kind of library will only get you so far. You should only look at the available technologies once you have a good idea of how many different kind of screens your application should have and what they look like.
Most of the apps with amazing UIs (Opera Mini, Gmail, any game from an AAA developer) use custom UIs developed in-house. These developers take the task of developing an UI as one more in their projects and give it personality, involving professional graphic designers. Going with a packaged library would quickly accomplish the task but it would make the application look generic and bland (less bland that with the default UI, but still bland and limited).
In short, go with a packaged UI for quick development, but don't expect the level of quality to be near the apps you mentioned.
I'm facing a similar dilemma right now. We're currently using the default, high-level LCDUI framework for the speed of development, but its severely limiting what we can do. I had thought our best option would be to use a third-party UI framework, but I'm now coninced that if we're serious about the application we should write our own. Its like anything in software, if its mission critical to your application you should write it yourself, even if it that means re-inventing the wheel.
Digitalapes has developed a framework for J2ME application development that includes a high level UI library.
The library is lightweight and well documented, you can get have a look at the Gear framework page for more information, or you can directly download the JAR and javadoc from Gear's sourceforge page.
Digitalapes blog includes also a series of tutorial about how to use the framework.
Polish has really nice set of UI components, which are skinable with css style comments.
It also features a device database for compatibility purposes.
Some tipps if you decide to go with polish (as i did):
Use eclipse and the mepose plugin. The netbeans integration is really nerve wracking.
The bulletin board is dead, so by all means !use the mailing list!.
If you are not familiar with the ant building system, you better start now.
The J2ME Polish book is not worth its money. (My opinion). The documentation on their website and the sample coded are enough to give you a solid start.
I've used SWT when deploying to a full profile J2ME (IBM J9 on PocketPC), I don't know if it is usable by MIDlets however. It's quite a nice GUI library in its own way, and far better than AWT.
Unfortunately companies usually end up designing their own GUI's when it comes to mobile development. It's the only way to have full control over your interfaces, but you should consider if it's worth the additional development time, and you're also on your own when it comes to device compatibility issues / handset bugs - of which there are plenty.
If you are happy with a less flexible interface, you can go with one of the existing libraries. I currently use J2ME GUI from http://www.garcer.com/. We get the same flexibility as with desktop development and it also features custom styling, so with a little extra effort you can make it look the way you want it to.
You can use LWUIT for the UI development in J2ME framework.