Difference between Java Swing application & Netbeans platform Swing - java

I want to develop a simple desktop application that connects to the Java DB , using Java Swing for the interface design.
I am new to Swing so I tried some tutorials on the net and came across
the Netbeans platform Swing components.
What is
the difference between the Java Swing architecture and the Netbeans Swing components?
Which one will be appropriate for developing interfaces
for desktop applications in Java?

From The NetBeans Platform:
The NetBeans Platform is a generic framework for Swing applications. It provides the "plumbing" that, before, every developer had to write themselves—saving state, connecting actions to menu items, toolbar items and keyboard shortcuts; window management, and so on.
It is an API built with Swing, that is supposed to provide some extra 'built-in' functionality. Since you need to know Swing to be able to use it. I suggest you concentrate on Swing for now.

Actually, it will be better to move on Intellij Idea from Jet Brains. It’s much more better than NetBeans IDE. Of course, it’s only my opinion.

Related

Need to migrate Existing large Java Swing application running on Linux to IOS(mobile platform)

I have an existing Large Java Swing GUI application and would like to
migrate to IOS(Mobile app). Will Java Swing work for sure with robovm?
Just compile to the bytecode on MAC and run it on IOS, is it
going to be that simple and there is going to some work involved in it?
Will it support all the 3rd party jars or are there any restriction in it?
Are there any other alternatives on opensource or otherwise simpler for Java Swing GUI application migration to Mac OS?
I don't think Swing is going to work with RoboVM. Even if it does, the App Store will very likely reject your app because it won't conform with their UI guidelines.
As far as the non-ui logic in your app, RoboVM should handle it given you're not making native calls.
I know of no Swing to Mac UI converters. You're probably better off reskinning your app.
Codename One is very much like Swing and was modeled based on it, it will allow you to port the code relatively easily (layout managers etc.). Porting a Swing app should be trivial see this quick getting started for Swing developers: http://www.codenameone.com/swing.html

Is JavaFX supposed to supersede Swing?

I am used to Swing programming and have heard about JavaFX. Is it supposed to replace Swing as the preferred platform for writing desktop applications in Java?
To put it in another way, should I choose JavaFX for my new project?
Yes JavaFX is replacing Swing.
See also official documentation of Oracle:
http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#6
Is JavaFX replacing Swing as the new client UI library for Java SE?
Yes. However, Swing will remain part of the Java SE specification for
the foreseeable future, and therefore included in the JRE. While we
recommend developers to leverage JavaFX APIs as much as possible when
building new applications, it is possible to extend a Swing
application with JavaFX, allowing for a smoother transition.
See also SO posts:
Swing vs JavaFx for desktop applications
https://stackoverflow.com/questions/1318645/javafx-or-swing (OLD)

Desktop GUI framework

I tried to create a new Swing GUI desktop application template using NetBean 7.0 and just found NetBean has a disclaimer:
"Note that JSR-296 (Swing Application Framework) is no longer developed and will not become part of the official Java Development Kit as was originally planned. You can still use the Swing Application Framework library as it is, but no further development is expected."
So does it mean swing will stay the same from now on and nothing new will be added? What will that impact the applications using Swing? Do I need to consider other GUI frameworks instead? What would be the best framework option for a scientific plotting and graphic heavy application?
Thanks.
Swing is part of JAVA since 1.2 and it is part of the JAVA STANDARD. It is not going anywhere any time soon.
The JSR-296 (Swing Application Framework) was a framework to simplify and help developing in swing, which didnt go very far. Netbeans uses it internally. If using JAVA 7 then, like many other netbeans specific libraries, you need to ship it separately with you app, because it is not standard.
So, feel free to develop in swing. A pure swing app WILL WORK on any JAVA STANDARD on almost any platform for a long time to come. If you use the SAF, thats also OK, but that is not standard and its pretty much dead, so just remember to ship the jar with your app.
Hope that clarifies the situation.

Is Java Swing out of date?

I downloaded Net Beans IDE and created a new desktop aplication. I choose it to be Swing app. The IDE displayed that the Swing framework is out of date and will not be supported in the future.
Does this mean that Swing is out of date? And if so what are the most recent frameworks that can be used to develop desktop applications?
thanks
In NetBeans the Desktop Application project type is a project based on an external library that was supposed to be the Swing Application Framework (which does things like session state of GUI controls and resource bundle management) but never matured. So that project type is outdated.
However Swing itself (the GUI platform) is `current' in the sense that it is the foremost GUI toolkit that Java has and will continue to have for some time.
The Swing Application Framework (JSR296) was a project intended to extract the common elements for developing applications with Swing. It is safe to use but is no longer being developed. The official page https://appframework.dev.java.net/ suggests a couple of alternatives, including using the netbeans platform itself and, given how greatly netbeans has matured, I would be keen to investigate this approach.
Swing itself is fine, it'll be around as long as Java is. Though in saying that desktop Java has never really taken hold in the same way other flavours have.
AFAIK Swing is definitelly not out of date and will be even enhanced in JDK7
Maybe you should show us screenshot, it might be misunderstanding
I think something wrong with your netbeans. Can you show some screenshot?
The future of swing

What should I choose SWT or Swing to program GUI in Java?

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.

Categories