Converting Swing application to JavaFX [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
What are the necessary steps for converting a Swing application into JavaFX?
It would also be interesting to know about the best practices when performing this task (i.e. problems that can be encountered and resolutions).

I don't know if there are "best" practices there, as JavaFX is quite new and people are more busy making new JavaFX programs than converting old Java ones...
First, I would ask why you want/need to do that... Second, I would say it depends on the purpose and complexity of the Swing program.
If that's a plain dialog, it shouldn't be hard. If it is a complex application with sub-panels, lot of pop-up dialogs, menus, MDI behavior with docking, etc., it might be hard to impossible to port...
Somehow, it might be better to rewrite the GUI from scratch, knowing that you have to either use a wrapper of Swing components in JavaFX, or limit yourself to the (currently) limited range of native JavaFX components.
Now, if your application was written with good principles, you can rewrite only the view and controller parts, and re-use (most of) the models / business logic as JavaFX can very well exploit Java classes.

Related

Java GUI programming beginner tips [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Im quite good with writing text based programs using Java and ill like to proceed to writing GUI programs and animations ive checked several youtube playlists and they dont seem do helpful so i would appreciate any tips on where to start.
For desktop applications, You should start with Java Swing.
Swing API is a set of extensible GUI Components to ease the
developer's life to create JAVA based Front End/GUI Applications.
There are some good tutorials, I would suggest the following:
JavaTPoint and TutorialsPoint
After completing swing, you can move on to JavaFX.
JavaFX is a set of graphics and media packages that enables developers
to design, create, test, debug, and deploy rich client applications
that operate consistently across diverse platforms.
For that, you may follow to begin with
code.makery
Sounds as a great question, but not self explanatory. Before making assumptions just ask your self -
Do I feel myself as Web developer or a Desktop(Core) developer?
From a prospective of Desktop developer - take a look at Swing - it allows to make GUI forms and etc. If you decide to learn web, then take a look at Vaadin (which is made on top of GWT, and easier to dive in)..
Both of them have simlar syntax, so it would be always easier re-qualify...
UPDATE: While you still decide where to go, see this humble example of Vaadin Application

Java NetBeans Form Creator [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am a C# .NET developer and I always use Visual Studio to create my applications. Now I am studying Java with the netbeans IDE and I have no clue of how to create a Form Application?
I have used Jform etc. But this is just annoying. I was trying for 3 hours just to relocate a button while resizing my window.
Does anyone have any suggestions on how to make this easier?
Unfortunately, IMHO, creating GUI applications in Swing is a pain, especially coming from .NET.
Whenever I need to create Swing apps I find it easier to just hand code it. Although it involves much more work than in .NET, and also has a pretty steep learning curve, I find I have more control over my code that way.
BTW, once you get the hang of how things work in Swing, hand coding is pretty manageable.
Good Luck!

How to create graphics in Java? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I was wondering about how is possible to make graphics in a programming language just like Java, I mean in the web there are HTML + CSS etc but what here?
I already found out I might start to code with Java Swing (?) but if that's so: where's the best place to start learning it and really briefly: what can I do with that?
Please, note I don't want to start a broad talk with this question, so don't worry and be brief if you don't want to spen too many words with it ;)
For graphics you can use a Canvas/JPanel with Swing, JavaFX, or libGDX if you need a bit more power behind your graphics as it used OpenGL.
As some of the other commenters have already shown, there are many tutorials on how to use all three options, so you're pretty-well set to learn whichever you choose. I'm not entirely sure how well JavaFX deals with graphics, but Swing works perfectly fine for most purposes.

Is Swing Still in Use Today? [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 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.

"Proper" way to develop a JAVA GUI application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I would appreciate it a lot if someone enlightened me on what is the "proper" way to build a java application which utilizes the Swing. How you navigate through the views of the program?
To further elaborate on what I have in mind:
I need a menubar at the top of my Frame and when the user selects a menu item the application should present him the right view. These "views", are they panels? How do you create such an application? I have tried with panels and show, hide functions but I am not pleased with the result. Is this the proper way to build such an application? Looking forward to your answers guys!
Thanks a lot in advance!
If it is a simple application, JFrame and JMenuBar is enough. If it is built out of a number of screens, as your question suggests, then CardLayout can be useful to manage which screen is showing. Building those out of individual JPanels is a good idea.
There are various GUI builders built into Java IDEs which can help you design those panels and wire them up to your code that implements the logic of the application.
How the pieces of the application communicate with each other is up to you; the typical pattern is to have a "model" class for each one which populates the models of the individual components.
If it is a very complex application, you may want to use a framework which takes care of the plumbing of a desktop application, such as the NetBeans Platform or other similar frameworks.
You can use a JFrame.On the top of it, have a menu bar, you can add items to it.You can also add sub menu to items.You can perform action on its event.Netbeans provide a easy way, but it is not recommended from coding point of view.

Categories

Resources