This question already has answers here:
Swing vs JavaFx for desktop applications [closed]
(6 answers)
Closed 7 years ago.
I am using Java Swing to develop my application and i should finish it as soon as possible, but the design is very bad.
I found some advice which tells me that I should use JAVA FX.
What is the difference between Java FX and Java Swing ?
Will there be any change on the line of code?
Main difference could be the release date... JavaFX is more recent and can be considered as the successor of Swing.
There is many very useful features added in JavaFX.
See here some key features : https://docs.oracle.com/javase/8/javafx/get-started-tutorial/jfx-overview.htm#A1131418
I can list the main features for me:
Styles can be set by CSS (something similar to)
Bindings: easy way to bind a ui-value, like width of text of input, to a field in class. Changing the value of the field updates the ui without boilerplate
Animations/Transitions: easy way to make an animation, like a ui components which blinks or moves
3D: easy way to manipulate model to make animated 3D view
For making a new application from scratch, i think you should consider using JavaFX, Swing is outdated (imho)
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I am currently working on an application with a code base that dates back to at least 2001. One of the components of this system is a desktop client that is written using Java Swing. It uses most of the good old layouts including BorderLayout, FlowLayout, and Gridbag layout. There are a number of fairly complex screens we need to manage and update periodically and we sometimes need to create new features with new user interfaces.
Is there something better than Swing we could look into migrating to?
Would it be possible to do this migration in stages (i.e. we would have a mix of the old Swing components with the new components during a prolonged migration phase)?
If we were to re-write the desktop client in Java today should we still use Swing?
I find myself using primarily GridBagLayout, is this still the tool of choice for more complex layouts or are there better layouts I could be using?
I was reading in book that Oracle intend to replace Swing by JavaFX.
Take a look in the question and answer bellow:
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.
You can see there original comment here.
In this case, I believe that you can consider to user JavaFX.
More details here and good examples here.
If you are using Java 8 you can use javafx for new componant. It's possible to use Swing componant with javafx.
you can still use java swing, but if you need to migrate you can migrate in stages using JavaFX (again a Desktop Client). if you need to use Web Client, then you could use GWT (this helps since the developers already have knowlege of UI Components) and GWT code is in Java and Javascript gets generated in Compile Time.
Java FX is more powerful and beautiful
We can say that swing is replaced with java FX.
Now a days no body is using swing because there are lot of advantage in java FX over swing
It has good feature called scaneBuilder we can just drag and drop the components to appropriate position so lot of time is saving.
Different type of layout are there to place the components attractively.
Impertinently we can use CSS to disign the UI so is more beautiful and attractive
we can integrate with web components also.
If you're redoing a layout entirely, I'd look at Matisse which uses Spring Layout.
https://netbeans.org/features/java/swing.html
It's far easier to get the relationships between components using a layout tool than trying to line everything up manually in GridBag or something similar.
If you're not redoing a major part of the code, I wouldn't touch it. Don't fix what ain't broken.
Regarding JavaFX, I personally have not been impressed by it. You can take a look at it, but JavaFX struck me as needing more "bake" time. I would not abandon Swing just yet.
If you need to have a Java desktop client looks like native application for some platform (Windows, MacOS, Linux) you can look on Standard Widget Toolkit (SWT) library.
One famous application example of usage of this library is Eclipse IDE. Another - Angry IP Scan, sources are at GitHub.
This question already has answers here:
Java GUI frameworks. What to choose? Swing, SWT, AWT, SwingX, JGoodies, JavaFX, Apache Pivot? [closed]
(9 answers)
Closed 8 years ago.
Is there any alternative of swing?
I need a high performance GUI toolkit to create desktop application on linux (Ubuntu). I've been creating swing application for 2 years, therefore I want use java.
Yes, there's a number of other UI toolkits available - AWT, SWT, JavaFX, QT to name a few.
I'd primarily recommend JavaFX as the new UI toolkit (it's now part of Java8 and is still under heavy development) or perhaps SWT if you want the "native" feel (since it uses native OS components.) QT does this as well of course, but it requires bindings and is generally more of a faff - so its use is relatively rare in Java land.
On the other sided of things, I'd recommend staying away from AWT (it's the old, original Java GUI framework that lacks many common components in other UI toolkits, and is not really supported any more.)
Try Java FX. It will give you better performance than java Swing. Java FX
Take a look at JavaFX it's now part of the JRE/JDK for Java 8.
http://docs.oracle.com/javase/8/javase-clienttechnologies.htm
You can probably use SWT as an alternative.
https://www.eclipse.org/swt/
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
The community reviewed whether to reopen this question 9 months ago and left it closed:
Duplicate This question has been answered, is not unique, and doesn’t differentiate itself from another question.
Improve this question
Is Java Swing still in use? is the most recent post I found, and it is 4 years old (now 12 years old), so...
Is Swing used at all in a professional environment? I am a student, and wondering if it is worth learning, or if its day has passed.
(I am not asking about a Swing-AWT comparison...just whether or not Swing is obsolete in the workforce.)
Majority of existing GUI java codebases are Swing and likely will stay that way until the codebase rots and nobody maintains it anymore.
Majority of new GUI java codebases are using JavaFX, which is the Swing replacement in Java8 and is part of the standard java library now. It allows for CSS skinning, HTML5 elements, and also has a very nice FXML (a dialect of XML/HTML) which allows non-programmers to "get in there" and work on the GUI layout, etc. It also has SceneBuilder which is a free/standard GUI drag-n-drop builder which auto-generates FXML for your program.
I kid not when I say FXML can replace 3,000 lines of extended JFrame class code for a Swing GUI, with 50 lines of FXML. (recent project I helped migrate).
Swing is still used heavily, and will continue to be for a long while -- after all, it was the only choice for Java for a loooong time. JavaFX, however, is refreshingly nice, and very-much-so worth learning.
As an aside -- Swing builds ontop of AWT - AWT has a lot of problems, most of which are marked as "wont-fix" by the java project (OpenJDK/Oracle). Swing was built to replace/fix AWT, however sometimes you will marry AWT objects into your Swing application. Heck, you will sometimes marry Swing objects into your JavaFX application. I would not bother with learning AWT, if you learn Swing, you are learning AWT for the most part. The largest difference with Swing vs AWT is Swing components start with the letter J. EX: JFrame vs Frame, etc.
Well, Intellij IDEA uses Swing for its UI, so I would not say that it is obsolete. Granted, I really think it could use a huge overhaul (read: something not full of spaghetti code).
Absolutely yes. Legacy swing applications are still supported and enhanced. There is no alternative for that. And if you are making applications like IDE's, SWING is still preferred. New application will of course have web-interfaces , but that really depends on the nature of the application. No generic rules.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Swing components are light-weight?
There are different answers for this, but the thing is, that every place has explained it just saying AWT using a native window for every component and Swing has not been used in those examples, how does it work in Swing?
I'm not sure I completely understand your question but here goes:
Most Swing components are entirely lightweight - they are implemented with pure Java code. As far as the OS is concerned, the Swing lightweight components don't exist.
However you should know that Swing always uses at least one native component (usually the top-level window). The rest of Swing (all the lightweight components) are implemented so that they perform painting within this native component.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to use HTML and CSS as a Java application GUI?
I'm trying to found another way to create GUIs for Java programs without Swing. I want something more dynamic and easy to use than Swing.
There is anything that I can use for this?
In truth, I want something similar to HTML. Exists?
JavaFX 2.0 might be what you are looking for (ignore JavaFX 1.0 which is very outdated):
It has an HTML-style layout language called FXML.
It also allows skinning of user interfaces with CSS-style themes.
It also has a WebView component that allows you to embed any web / HTML content in your app.
Having said that, I don't think Swing is hard to use when you get used to it, particularly if you use an improved layout manager like MigLayout.