Class RadianceMetricsUtilities
java.lang.Object
org.pushingpixels.radiance.theming.internal.utils.RadianceMetricsUtilities
Utility methods to keep component preferred size and component painting in sync.
All update() calls in the UI delegates use
RadianceCommonCortex.installDesktopHints(java.awt.Graphics2D, java.awt.Font)
on the passed Graphics
object. Components that show texts (labels, buttons, etc)
should also account for text hinting for computing the preferred size. Otherwise on
some JVM versions on specific screens the width of unhinted text is not the same as the
width of hinted text, leading to text cut-off.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static Rectangle
private static Insets
private static Map
<HashMapKey, FontMetrics> private static Map
<Double, BufferedImage> private static Map
<HashMapKey, FontRenderContext> private static Rectangle
private static Rectangle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FontMetrics
getFontMetrics
(double scale, Font font) static FontRenderContext
getFontRenderContext
(double scale, Font font) static Dimension
getLabelPreferredSingleLineDimension
(JComponent component, String text, Font font) private static BufferedImage
getOffscreenImage
(double scale) static Dimension
getPreferredButtonSize
(AbstractButton button) static Dimension
getPreferredCheckButtonSize
(AbstractButton button, Icon defaultIcon) static Dimension
getPreferredLabelSize
(JLabel label)
-
Field Details
-
offscreens
-
metricsMap
-
renderContextMap
-
iconR
-
textR
-
viewR
-
insets
-
-
Constructor Details
-
RadianceMetricsUtilities
public RadianceMetricsUtilities()
-
-
Method Details
-
getOffscreenImage
-
getFontMetrics
-
getFontRenderContext
-
getPreferredLabelSize
-
getLabelPreferredSingleLineDimension
public static Dimension getLabelPreferredSingleLineDimension(JComponent component, String text, Font font) -
getPreferredButtonSize
-
getPreferredCheckButtonSize
-