Is it possible create a Java desktop GUI with HTML? [duplicate] - java

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.

Related

How do I display Swing component on JSP? [duplicate]

This question already has answers here:
Is it possible to display Swing components in a JSP?
(3 answers)
Closed 5 years ago.
I want to do this because I want to print a Swing component on client side printJob.print(); always print on server side. Is there any other way to do so?
Since browser manufacturers removed support for applets and Java Web Start, and they were deprecated by Oracle, there is really no way to display Java GUI components on the client side from within a web-app.
An alternative might be to generate an image of the component on the server side and send that image to the client. On the other hand, there is little that can be rendered in a Swing component that can't be rendered in pure HTML, so I doubt that Swing components are even necessary.

Should I keep using Swing for my desktop application [closed]

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.

What is the difference between unsing JAVA FX and SWING [duplicate]

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)

Is there any alternative of swing? [duplicate]

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/

How light-weight is a Swing Component? [duplicate]

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.

Categories

Resources