File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Tutorial: GUI with Swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Tutorial: GUI with Swing" Watch "Tutorial: GUI with Swing" New topic

Tutorial: GUI with Swing

Nicole Schmidt

Joined: Jul 07, 2008
Posts: 5
Hi Java Guys,
I try to write a cool desktop app. But I find it really difficult to make a good GUI with swing. Does anybody know a good online Tutorial, or book (need not to be online)?
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1323

The one I know is.

[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
The Swing Tutorial is a good start. The complete tutorial can also be downloaded. All the example codes for individual Swing features are here. A few more tutorials can be found here.

If you're just starting out with Swing I'd stay away from additional libraries like JGoodies.
[ August 03, 2008: Message edited by: Ulf Dittmer ]
Nicole Schmidt

Joined: Jul 07, 2008
Posts: 5
I find it specially difficult to place my controls in a "nice" way on the panel. It always looks nasty.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Well, "nasty" is of course relative to your design sensibilities :-)

Generally, using an appropriate LayoutManager puts components into proper places. I find myself using BoxLayout and GridLayout a lot, possibly using a hierarchy of JPanels.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46380
Go to Cai Horstmann's website and search for the GBC class designed for assistance getting GridBagLayout to work.
The classic tutorial about GridBag is here .
Jelle Klap

Joined: Mar 10, 2008
Posts: 1951

If you're already familiar with the basics of Swing, I can recommend the book Filthy Rich Clients.
To quote directly from its preface: "This book is about building better, more effective and cooler desktop applications using graphical and animated effects". I found it to be an immensely fun and educational read!

Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
I agree. Here's the link:
subject: Tutorial: GUI with Swing
It's not a secret anymore!