Class RadianceMetricsUtilities
- java.lang.Object
-
- org.pushingpixels.radiance.theming.internal.utils.RadianceMetricsUtilities
-
public class RadianceMetricsUtilities extends java.lang.ObjectUtility methods to keep component preferred size and component painting in sync. All update() calls in the UI delegates useRadianceCommonCortex.installDesktopHints(java.awt.Graphics2D, java.awt.Font)on the passedGraphicsobject. 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
Fields Modifier and Type Field Description private static java.awt.RectangleiconRprivate static java.awt.Insetsinsetsprivate static java.util.Map<HashMapKey,java.awt.FontMetrics>metricsMapprivate static java.util.Map<java.lang.Double,java.awt.image.BufferedImage>offscreensprivate static java.util.Map<HashMapKey,java.awt.font.FontRenderContext>renderContextMapprivate static java.awt.RectangletextRprivate static java.awt.RectangleviewR
-
Constructor Summary
Constructors Constructor Description RadianceMetricsUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.FontMetricsgetFontMetrics(double scale, java.awt.Font font)static java.awt.font.FontRenderContextgetFontRenderContext(double scale, java.awt.Font font)static java.awt.DimensiongetLabelPreferredSingleLineDimension(javax.swing.JComponent component, java.lang.String text, java.awt.Font font)private static java.awt.image.BufferedImagegetOffscreenImage(double scale)static java.awt.DimensiongetPreferredButtonSize(javax.swing.AbstractButton button)static java.awt.DimensiongetPreferredCheckButtonSize(javax.swing.AbstractButton button, javax.swing.Icon defaultIcon)static java.awt.DimensiongetPreferredLabelSize(javax.swing.JLabel label)
-
-
-
Field Detail
-
offscreens
private static java.util.Map<java.lang.Double,java.awt.image.BufferedImage> offscreens
-
metricsMap
private static java.util.Map<HashMapKey,java.awt.FontMetrics> metricsMap
-
renderContextMap
private static java.util.Map<HashMapKey,java.awt.font.FontRenderContext> renderContextMap
-
iconR
private static java.awt.Rectangle iconR
-
textR
private static java.awt.Rectangle textR
-
viewR
private static java.awt.Rectangle viewR
-
insets
private static java.awt.Insets insets
-
-
Method Detail
-
getOffscreenImage
private static java.awt.image.BufferedImage getOffscreenImage(double scale)
-
getFontMetrics
public static java.awt.FontMetrics getFontMetrics(double scale, java.awt.Font font)
-
getFontRenderContext
public static java.awt.font.FontRenderContext getFontRenderContext(double scale, java.awt.Font font)
-
getPreferredLabelSize
public static java.awt.Dimension getPreferredLabelSize(javax.swing.JLabel label)
-
getLabelPreferredSingleLineDimension
public static java.awt.Dimension getLabelPreferredSingleLineDimension(javax.swing.JComponent component, java.lang.String text, java.awt.Font font)
-
getPreferredButtonSize
public static java.awt.Dimension getPreferredButtonSize(javax.swing.AbstractButton button)
-
getPreferredCheckButtonSize
public static java.awt.Dimension getPreferredCheckButtonSize(javax.swing.AbstractButton button, javax.swing.Icon defaultIcon)
-
-