I\'ve been working with Swing for a while now but the whole model/structure of JFrame
s, paint()
, super
, etc is all murky in my mind.
I nee
If, after reading the Swing tutorial, you find your interest lies in more advanced topics, you may also wish to look at Swing Second Edition by Robinson and Vorobiev.
Filthy Rich Clients by Chet Haase and Romain Guy is a great book about Java UI. It covers some more advanced stuff too, but introduction and few first chapters explain fundamental things well.
Have you looked at the Java Swing Tutorial (click here)? It does a pretty good job of covering the basics of developing Swing applications.
I found Swing Explorer to be a precious tool to understand the hierarchy of components (particularly in complex GUIs) and look at properties (alas, read-only: we get used to Firebug convenience!). It has an Eclipse plugin.
I've found that simply browsing around in the source code (ctrl-click on a name if you're using NetBeans) has been really helpful. If I see a method appear in the completion dialog that I'm not familiar with, I'll just click "Go to source" and look around until I'm comfortable with it.
The same happened to me. Actually to this day I don't quite get 100% how all it works.
Swing is a very flexible framework - perhaps too flexible. With flexibility comes a lot of abstraction and with abstraction comes confusion. :)
I've found the following articles worth reading. They helped me to better understand the big picture of Swing.
The process of installing a UI delegate, which is just this image:
They explain quite well how the model and the delegate work. It always drives me mad when I see those JLabel
, LabelUI
, ui.update
, etc.