Class HudPaintingUtils
- java.lang.Object
-
- com.explodingpixels.macwidgets.plaf.HudPaintingUtils
-
public class HudPaintingUtils extends java.lang.ObjectA collection of utilty method for painting Heads Up Style widgets. See the following for examples of HUD widgets:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHudPaintingUtils.RoundednessAn enumeration representing the roundness styles of HUD buttons.static interfaceHudPaintingUtils.ShapeProvider
-
Field Summary
Fields Modifier and Type Field Description static java.awt.ColorBORDER_COLORstatic java.awt.ColorFONT_COLORstatic java.awt.ColorFONT_DISABLED_COLORstatic java.awt.ColorPRESSED_MARK_COLOR
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intgetHudControlShadowSize(javax.swing.AbstractButton button)Gets the number of pixels that a HUD style widget's shadow takes up.static java.awt.FontgetHudFont()Gets the font used by HUD style widgets.static voidinitHudComponent(javax.swing.JComponent component, boolean isDarkColorScheme)Initializes the givenJComponentas a HUD style widget.static voidpaintHudControlBackground(java.awt.Graphics2D graphics, java.awt.Rectangle bounds, HudPaintingUtils.ShapeProvider shapeProvider, java.awt.Paint paint)Paints a HUD style background in the given shape.static voidpaintHudControlBackground(java.awt.Graphics2D graphics, javax.swing.AbstractButton button, int width, int height, HudPaintingUtils.Roundedness roundedness, boolean isDarkColorScheme)Paints a HUD style button background onto the givenGraphics2Dcontext using the givenHudPaintingUtils.Roundedness.static voidupdateGraphicsToPaintDisabledControlIfNecessary(java.awt.Graphics2D graphics, java.awt.Component component)Installs anAlphaCompositeon the given {@link Graphics2D) if the given {@link Component} is disabled.
-
-
-
Method Detail
-
initHudComponent
public static void initHudComponent(javax.swing.JComponent component, boolean isDarkColorScheme)Initializes the givenJComponentas a HUD style widget. This includes setting the font, foreground and opacity of the given component.- Parameters:
component- the component to initialize as a HUD component.
-
getHudFont
public static java.awt.Font getHudFont()
Gets the font used by HUD style widgets.- Returns:
- the font used by HUD style widgets.
-
getHudControlShadowSize
public static int getHudControlShadowSize(javax.swing.AbstractButton button)
Gets the number of pixels that a HUD style widget's shadow takes up. HUD button's have a shadow directly below them, that is, there is no top, left or right component to the shadow.- Parameters:
button- the button that the shadow is drawn on.- Returns:
- the number of pixels that a HUD style widget's shadow takes up.
-
paintHudControlBackground
public static void paintHudControlBackground(java.awt.Graphics2D graphics, javax.swing.AbstractButton button, int width, int height, HudPaintingUtils.Roundedness roundedness, boolean isDarkColorScheme)Paints a HUD style button background onto the givenGraphics2Dcontext using the givenHudPaintingUtils.Roundedness. The background will be painted from 0,0 to width/height.- Parameters:
graphics- the graphics context to paint onto.button- the button being painted.width- the width of the area to paint.height- the height of the area to paint.roundedness- the roundedness to use when painting the background.isDarkColorScheme- whether to use the light or dark color scheme for this button
-
paintHudControlBackground
public static void paintHudControlBackground(java.awt.Graphics2D graphics, java.awt.Rectangle bounds, HudPaintingUtils.ShapeProvider shapeProvider, java.awt.Paint paint)Paints a HUD style background in the given shape. This includes a drop shadow which will be drawn under the shape to be painted. The shadow will be draw outside the given bounds.- Parameters:
graphics- theGraphics2Dcontext to draw in.bounds- the bounds to paint in.shapeProvider- the delegate to request theShapefrom.paint- thePaintto use to fill theShape.
-
updateGraphicsToPaintDisabledControlIfNecessary
public static void updateGraphicsToPaintDisabledControlIfNecessary(java.awt.Graphics2D graphics, java.awt.Component component)Installs anAlphaCompositeon the given {@link Graphics2D) if the given {@link Component} is disabled.- Parameters:
graphics- theGraphics2Dto adjust.component- theComponentwhos enablement state should be queried.
-
-