Swing in general

Swing is a large and complex part of the Java libraries. Perhaps not unexpectedly, it is also challenging to learn and use. It also has some bugs.

Useful tools from Sun include :

Long methods

There is a widespread tendency for GUI code - in particular initialization code - to be implemented with very long methods. This is probably a bad idea, for the same reason that all excessively long methods are a bad idea - they are harder to understand and maintain.

Unnecessary Fields

Fields should be created only if necessary. If a particular element is created, wired into the GUI, and then no longer referenced anywhere else in the class, then it should probably not exist as a field, but rather as a simple local variable. This style will allow the more important GUI elements (fields) to stand out from the less important ones (local variables).

Good habits


See Also :
Look and Feel guidelines
Standardized dialogs
Would you use this technique?
Yes   No   Undecided   
© 2013 Hirondelle Systems | Source Code | Contact | License | RSS
Individual code snippets can be used under this BSD license - Last updated on August 30, 2012.
Over 2,400,000 unique IPs last year - Built with WEB4J.
- In Memoriam : Bill Dirani -