Welcome to the Ranch!
jon ninpoja wrote:i read that swing is dead and that you shouldnt use it,rather use javafx
but i have recently read bad things about javafx to...that it is on the way out...but not quite
I assure you, you can find someone somewhere who will tell you that absolutely any technology is one, or all, of the following:
Dead.No longer supported.Soon to be replaced.Only used on servers, desktops, iPads, secret DARPA mainframes, or an abacus.
Oracle certainly said that it planned for JavaFX to replace Swing. That was a while back, and it hasn't happened. Indeed, it seems to me that a certain retrenchment on that plan materialized when they dropped their support of SceneBuilder, the JavaFX GUI editor. I know some programmers who say they don't use a GUI editor, but I believe many do (I'm one) and, for a new programmer, I think a GUI editor is a very helpful tool. The Matisse GUI editor, which is built into NetBeans (the IDE
I use), and probably others, works with Swing. It generates some questionable code, but it does work. Also, a large part of the Jave SE standard library is devoted to Swing. I'm confident that library code will be around for a long, long time.
So, "Swing is dead" is something I, personally, believe people say mostly to be shocking or feel smug. It exists, it works fine, it is thoroughly documented, and still the only GUI library with built-in editor support in my IDE. I use it.
I would venture this advice: Swing's programming model is a lot like many GUI programming models. If you learn to use it in your code and, one day, discover that something unprecedented has happened (namely, that a lot of internet wags making shocking statements and feeling smug about them turned out to be right), it won' t mean you've wasted your time and will have to start over again. Learning Swing means learning concepts and techniques that migrate well to other GUI systems.
I guess I've been programming GUIs since maybe 1981(?). That includes Windows, X Windows, SunView (that one really is dead), curses, Swing, and Windowpanes (no, you've never heard of "Windowpanes," because I wrote that one myself, just before Microsoft released "Windows," and, yes, I cry myself to sleep some nights over that). Here's what I have to tell you after 35 years of it: if you can handle one of them, you can handle all of them. JavaFX actually has a few features that are somewhat distinctive, but that's often as much of a reason to avoid a software tool as it is to embrace it. For a new Java programmer, I would say start with Swing, but don't dig into to it on purpose. Use it to build the GUI you need for your application and, when you don't know how to do what you want, use that as the reason to dig a bit more. A carpenter would tell you to buy your tools when you need them. Approach Swing the same way: learn more about it when you need to. If and when you find a need to move to another GUI system, your Swing skills will help you do so.
And, of course, when you get stuck, come back and ask for help. We have that here!