Learning Java Swing (GUI builder or not?)?

I wouldn't say that Sun relies on NetBeans in their tutorials as much as references NetBeans because NetBeans is Sun's IDE.

I wouldn't say that Sun relies on NetBeans in their tutorials as much as references NetBeans because NetBeans is Sun's IDE. I use Eclipse for my Java development. A good IDE can help you with the busy work, so you can focus on the problem at hand.

If you want to learn Swing, I recommend The Definitive Guide to Java Swing, Third Edition. This book takes you step by step through layouts and widgets, using and reinforcing the MVC pattern of GUI development. For the advanced Swing developers, I recommend Swing Hacks: Tips and Tools for Killer GUIs.

This book shows you some tricks to make your GUI pop.

I may well get that book, I much prefer having a hard copy of something rather than an online reference, for some reason. – Paul May 18 '10 at 23:22 I'm the same way. Even with dual monitors, I prefer a book over most online tutorials.

– Gilbert Le Blanc May 18 '10 at 23:26 I learned Swing from the Core Java books in 2000 or so. Hopefully they are still as good! Amazon.Com/Core-Java-TM-I-Fundamentals-8th/dp/0132354764/… – Tim Perry May 19 '10 at 0:23 This is getting off topic, but I found Java(TM) Programming Language, The (4th Edition) amazon.

Com/Java-TM-Programming-Language-4th/dp/0321349806/… to be the best book for getting someone started in Java. – Gilbert Le Blanc May 19 '10 at 0:58 I think learning anything nontrivial requires a real world project, so even though a nice looking GUI (I suppose that's what you meant by "program") isn't your goal, you can't learn the real thing without trying to make a nice looking GUI. Also I'd recommend hand coding, since GUI builders may hide too many important things, so when the abstraction leaks you won't know where to plug.

– Geoffrey Zheng Sep 19 '10 at 3:55.

The tutorial predominantly is about code. It's really just the one chapter on NetBeans. The rest of it is about Swing and can be done in any IDE.

I would not recommend working with a GUI builder, simply because as you say, you don't get to understand what's going on underneath. Start with simply windows and progressively work you way through adding GUI components and interacting with them. Understand the advantages of the MVC way of doing things.

And the best recommendation I can give is don't sit down to "Learn" Swing. Pick yourself out a project that interests you and you can do using Swing. By having a goal of a working program in mind, you will better absort the lessons that the tutorials give.

1 IMHO that's one of the greatest downsides of Swing. It was conceived as so complex that no GUI builder can effectively cope with it and still allow the developer to do what they want. And after many hours of writing UI with Swing I still don't know how to structure my code that it's still readable and maintainable.

– Joey May 18 '10 at 23:21 Yeah that's my idea. I'm thinking of making a very simple game (or perhaps something simpler first) and I thought Swing would work for that. – Paul May 18 '10 at 23:23.

It seems you are a beginner in swings. I would recommend not to rely on Netbeans to develop swing UI. Try to design the UI by writing code only.

This will improve your knowledge base on swings and then you can go using the GUI builder available if you so wish.

I always learn new frameworks best the low-level-way. Learning a new programming language has proven to be the the best for me if I had to compile source files with the command line. Using an IDE like xCode makes it significant more hard to understand the basics.

I had a very hard way of learning to understand basic concepts of the Eclipse platform, because nearly all tutorials just tell you were to click in the Eclipse GUI. No up-to-date tutorial told what lines to add to what XML file and how the things belong together. Fortunately, this was much simpler for Swing.

Hence my recommendation: don't use a GUI builder for learning, because it hides all the important things which help to really understand what's going on. Use a good Java/Swing tutorial and start typing your applications. After you understand the basics, you can use a GUI builder for prototyping.

Actually those tutorials do reference Netbeans multiple times but usually still tell you how to do stuff in code. Once you got a fairly good grasp of how Swing in general works you will likely read each of those when you need it. For example Using Swing Components has (more or less) in-depth notes on each of the standard UI components and Laying Out Componnents has details about the standard layout managers.

Those are – at least for me – the things I return to the most. And exclusing a very brief touch with Netbeans I never touched its GUI builder again.

I think that you should learn the language first. Using an IDE makes you more efficient, however I think can lead to problems down the road should you need to use a different IDE. I find this book highly useful, Introduction to Java Programming.

All the examples in the book are in code.

That book looks like it's just for Java but it's specifically Swing I'm learning, I already have a reasonable grasp of Java – Paul May 18 '10 at 23:21 It has topics dedicated on Swing as well. As well as how to do applications that have a relatively basic GUI. You can use it as an introduction to Swing.

– npinti May 18 '10 at 23:26.

I've never found GUI builders to be very useful in Java anyway. NetBeans has a very good one, but I highly recommend you build your own GUIs. On the other hand, you may find Swing GUis somewhat verbose.

There are alternatives, Java-FX apparently has a declarative language that you can define your GUI in while writing everything else in Java. Also Groovy has a nice declarative syntax layer over Swing that can make things a little easier when starting out. If you want to experiment with Swing, I recommend playing with it in Groovy or BeanShell.It's a real quick to just type: f=new JFrame("My Frame") f.

SetVisible(true) f. SetSize(300,600) and see your frame show up on the screen.(Both Groovy and Beanshell handle Java syntax very well--it's not like you are not learning Swing--it's more like you are learning it in an interpreter instead of compiler... By the way, if you don't want to use Java's syntax Groovy can make it easer with statements that are SOMETHING like this (I may have it wrong by just a tad) f=new JFrame(name="My Frame", visible=true, size=300,600) which changes it from 3 or 4 lines down to one.

If you think coding Swing GUIs is verbose, you should start thinking of creating your own helper methods/classes. – Mike L. Aug 1 '10 at 15:16 @mklhmnn I always do, but I was speaking to someone who seemed like they were pretty new to Java.

– Bill K Aug 2 '10 at 17:26.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions