Skip to main content

How to use "undocumented secret" Swing properties

Posted by kirillcool on August 16, 2005 at 3:59 AM PDT

A spurious outburst of "undocumented secret" features of Swing keep popping up lately. The word "undocumented" seems to imply that no official Java documentation on Sun mentions them, and it's only after hours of poring over the JDK code the authors finally distilled these gems. Let's start then?

  • swing.defaultlaf that sets the default look and feel is well documented in UIManager javadocs. The fact that most of Java applications are unaware that they should check this setting before installing their own doesn't mean that this property is undocumented.
  • JTree.lineStyle for line style in Metal JTree appears not only in javadocs for MetalTreeUI, but also in (rather outdated) Sun tutorial on using trees.
  • swing.boldMetal for bold font settings in controls appears proudly in javadocs for MetalLookAndFeel
  • JToolBar.isRollover for rollover effects in toolbars appears in twelve bugs on bugparade and on 460+ entries on Yahoo search.

As amptly put in one of the reviews, did they actually mean to call this book "Swing Hacks For People Who Haven't Read Sun's Java Tutorial". The word "undocumented" is out of place here and should be replaced by "seldom-used". The word "secret" is also out of place (the sources are open, as well as plethora of online tutorials and books) and should be replaced by "little-known".