Package be.gaudry.swing.laf
Class UIManagerDefaults.SafeIcon
java.lang.Object
be.gaudry.swing.laf.UIManagerDefaults.SafeIcon
- All Implemented Interfaces:
Icon
- Enclosing class:
- UIManagerDefaults
Thanks to Jeanette for the use of this code found at:
https://jdnc-incubator.dev.java.net/source/browse/jdnc-incubator/src/kleopatra/java/org/jdesktop/swingx/renderer/UIPropertiesViewer.java?rev=1.2&view=markup
Some ui-icons misbehave in that they unconditionally class-cast to the
component type they are mostly painted on. Consequently they blow up if
we are trying to paint them anywhere else (f.i. in a renderer).
This Icon is an adaption of a cool trick by Darryl Burke found at
http://tips4java.wordpress.com/2008/12/18/icon-table-cell-renderer
The base idea is to instantiate a component of the type expected by the icon,
let it paint into the graphics of a bufferedImage and create an ImageIcon from it.
In subsequent calls the ImageIcon is used.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
int
void
-
Constructor Details
-
SafeIcon
-
-
Method Details
-
getIconHeight
public int getIconHeight()- Specified by:
getIconHeight
in interfaceIcon
-
getIconWidth
public int getIconWidth()- Specified by:
getIconWidth
in interfaceIcon
-
paintIcon
-