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(Graphics2D, 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 Rectangleprivate static Insetsprivate static Map<HashMapKey, FontMetrics> private static Map<Double, BufferedImage> private static Map<HashMapKey, FontRenderContext> private static Rectangleprivate static Rectangle -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FontMetricsgetFontMetrics(double scale, Font font) static FontRenderContextgetFontRenderContext(double scale, Font font) static DimensiongetLabelPreferredSingleLineDimension(JComponent component, String text, Font font) private static BufferedImagegetOffscreenImage(double scale) static DimensiongetPreferredButtonSize(AbstractButton button) static DimensiongetPreferredCheckButtonSize(AbstractButton button, Icon defaultIcon) static DimensiongetPreferredLabelSize(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
-