Package com.bric.multislider
Class PlafPaintUtils
- java.lang.Object
-
- com.bric.multislider.PlafPaintUtils
-
public class PlafPaintUtils extends Object
Some static methods for some common painting functions.- Author:
- Jeremy Wood
-
-
Constructor Summary
Constructors Constructor Description PlafPaintUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddrawBevel(Graphics2D g, Rectangle r)Uses translucent shades of white and black to draw highlights and shadows around a rectangle, and then frames the rectangle with a shade of gray (120).static TexturePaintgetCheckerBoard(int checkerSize)static TexturePaintgetCheckerBoard(int checkerSize, Color color1, Color color2)static ColorgetFocusRingColor()(package private) static PaintgetVerticalGradient(String name, int height, int y, float[] positions, Color[] colors)Create a vertical gradient.static voidpaintFocus(Graphics2D g, Shape shape, int pixelSize)Paints 3 different strokes around a shape to indicate focus.static voidpaintFocus(Graphics2D g, Shape shape, int pixelSize, Color focusColor, boolean changeRenderingHints)Paints 3 different strokes around a shape to indicate focus.
-
-
-
Method Detail
-
getFocusRingColor
public static Color getFocusRingColor()
- Returns:
- the color used to indicate when a component has focus. By default this uses the color (64,113,167), but
you can override this by calling:
UIManager.put("focusRing",customColor);
-
paintFocus
public static void paintFocus(Graphics2D g, Shape shape, int pixelSize)
Paints 3 different strokes around a shape to indicate focus. The widest stroke is the most transparent, so this achieves a nice "glow" effect.The catch is that you have to render this underneath the shape, and the shape should be filled completely.
- Parameters:
g- the graphics to paint toshape- the shape to outlinepixelSize- the number of pixels the outline should cover.
-
paintFocus
public static void paintFocus(Graphics2D g, Shape shape, int pixelSize, Color focusColor, boolean changeRenderingHints)
Paints 3 different strokes around a shape to indicate focus. The widest stroke is the most transparent, so this achieves a nice "glow" effect.The catch is that you have to render this underneath the shape, and the shape should be filled completely.
- Parameters:
g- the graphics to paint toshape- the shape to outlinepixelSize- the number of pixels the outline should cover.focusColor- the color of the focus ring to paintchangeRenderingHints- if true then the rendering hints will be modified, if false they will be left in tact
-
drawBevel
public static void drawBevel(Graphics2D g, Rectangle r)
Uses translucent shades of white and black to draw highlights and shadows around a rectangle, and then frames the rectangle with a shade of gray (120).This should be called to add a finishing touch on top of existing graphics.
- Parameters:
g- the graphics to paint to.r- the rectangle to paint.
-
getVerticalGradient
static Paint getVerticalGradient(String name, int height, int y, float[] positions, Color[] colors)
Create a vertical gradient. This gradient is stored in a table and reused throughout the rest of this session.- Parameters:
name- an identifying key for this gradient (used to cache it).height- the height of the gradienty- the y offset of the gradientpositions- the fractional positions of each color (between [0,1]).colors- one color for each position.- Returns:
- the vertical gradient.
-
getCheckerBoard
public static TexturePaint getCheckerBoard(int checkerSize)
-
getCheckerBoard
public static TexturePaint getCheckerBoard(int checkerSize, Color color1, Color color2)
-
-