[cp-patches] FYI: BasicLabelUI

Roman Kennke roman at kennke.org
Tue Apr 3 20:35:36 UTC 2007


This improves the BasicLabelUI:
- It caches the Insets instance.
- It makes the font metrics fetching more fail-safe.
- It removes the graphics color restoring, this is already performed by
Swing's painting mechanism.

2007-04-03  Roman Kennke  <roman at kennke.org>

	* javax/swing/plaf/basic/BasicLabelUI.java
	(cachedInsets): New field. Used for reusing the insets instance.
	(getFontMetrics): New helper method for fetching a suitable
	FontMetrics object.
	(getPreferredSize): Use new helper method for font metrics.
	(paint): Only do something if we have an icon or text.
	Use cached Insets instance and new font metrics helper.
	(paintDisabledText): Don't restore the graphics' color.
	(paintEnabledText): Don't restore the graphics' color.

/Roman

-- 
http://kennke.org/blog/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-patch
Size: 11108 bytes
Desc: not available
Url : http://developer.classpath.org/pipermail/classpath-patches/attachments/20070403/7ddd9b75/patch.bin


More information about the Classpath-patches mailing list