com.alee.utils
Class LafUtils

java.lang.Object
  extended by com.alee.utils.LafUtils

public final class LafUtils
extends java.lang.Object

User: mgarin Date: 27.04.11 Time: 17:41


Field Summary
static int halfButton
          Draws web styled selection using shapes operations.
static int halfLine
           
static int halfSelector
           
static int shadeWidth
           
 
Constructor Summary
LafUtils()
           
 
Method Summary
static java.awt.geom.GeneralPath createRoundedRectShape(int x, int y, int w, int h, int arcW, int arcH)
          Returns custom rounded rectangle shape
static java.awt.Shape createRoundedShape(int round, int... points)
          Creates rounded shape based on its corner points
static java.awt.Shape createRoundedShape(int round, java.awt.Point... points)
           
static java.awt.Shape createRoundedShape(int round, java.awt.Point[] points, boolean[] rounded)
           
static javax.swing.border.Border createWebBorder(java.awt.Insets insets)
          Creates border for web components.
static javax.swing.border.Border createWebBorder(int margin)
           
static javax.swing.border.Border createWebBorder(int top, int left, int bottom, int right)
           
static java.lang.Object disableAntialias(java.awt.Graphics g)
           
static java.lang.Object disableAntialias(java.awt.Graphics2D g2d)
           
static void drawAlphaLayer(java.awt.Graphics2D g2d, int x, int y, int width, int height)
           
static void drawAlphaLayer(java.awt.Graphics2D g2d, int x, int y, int width, int height, int size)
           
static void drawAlphaLayer(java.awt.Graphics2D g2d, int x, int y, int width, int height, int size, java.awt.Color light, java.awt.Color dark)
           
static void drawAlphaLayer(java.awt.Graphics2D g2d, java.awt.Rectangle rectangle)
          Draws alpha-background
static void drawAlphaLayer(java.awt.Graphics2D g2d, java.awt.Rectangle rectangle, int size)
           
static void drawAlphaLayer(java.awt.Graphics2D g2d, java.awt.Rectangle rectangle, int size, java.awt.Color light, java.awt.Color dark)
           
static void drawCustomWebBorder(java.awt.Graphics2D g2d, javax.swing.JComponent component, java.awt.Shape borderShape, java.awt.Color shadeColor, int shadeWidth, boolean fillBackground, boolean webColored)
          Paints custom shaped web styled border within the component with shadow and background
static void drawCustomWebBorder(java.awt.Graphics2D g2d, javax.swing.JComponent component, java.awt.Shape borderShape, java.awt.Color shadeColor, int shadeWidth, boolean fillBackground, boolean webColored, java.awt.Color border, java.awt.Color disabledBorder)
           
static void drawCustomWebFocus(java.awt.Graphics2D g2d, javax.swing.JComponent component, FocusType focusType, java.awt.Shape shape)
          Draws custom shaped web styled focus within the component
static void drawCustomWebFocus(java.awt.Graphics2D g2d, javax.swing.JComponent component, FocusType focusType, java.awt.Shape shape, java.lang.Boolean mouseover)
           
static void drawCustomWebFocus(java.awt.Graphics2D g2d, javax.swing.JComponent component, FocusType focusType, java.awt.Shape shape, java.lang.Boolean mouseover, java.lang.Boolean hasFocus)
           
static void drawDashedRect(java.awt.Graphics2D g2d, int x1, int y1, int x2, int y2, int stripeLength, int spaceLength)
          Draws dashed rectangle
static void drawDashedRect(java.awt.Graphics2D g2d, int x1, int y1, int x2, int y2, int stripeLength, int spaceLength, float stripeStart)
           
static void drawEtchedShape(java.awt.Graphics2D g2d, java.awt.image.BufferedImage topBg, java.awt.image.BufferedImage bottomBg, java.awt.Shape fullShape, java.awt.Shape bevelShape)
          Draws etched shape with specified background colors
static void drawShade(java.awt.Graphics2D g2d, java.awt.Shape shape, java.awt.Color shadeColor, int width)
          Draws web styled shade using specified shape
static void drawShade(java.awt.Graphics2D g2d, java.awt.Shape shape, java.awt.Color shadeColor, int width, boolean round)
           
static void drawShade(java.awt.Graphics2D g2d, java.awt.Shape shape, java.awt.Color shadeColor, int width, java.awt.Shape clip)
           
static void drawShade(java.awt.Graphics2D g2d, java.awt.Shape shape, java.awt.Color shadeColor, int width, java.awt.Shape clip, boolean round)
           
static void drawShade(java.awt.Graphics2D g2d, java.awt.Shape shape, ShadeType shadeType, java.awt.Color shadeColor, int width)
           
static void drawShade(java.awt.Graphics2D g2d, java.awt.Shape shape, ShadeType shadeType, java.awt.Color shadeColor, int width, boolean round)
           
static void drawShade(java.awt.Graphics2D g2d, java.awt.Shape shape, ShadeType shadeType, java.awt.Color shadeColor, int width, java.awt.Shape clip)
           
static void drawShade(java.awt.Graphics2D g2d, java.awt.Shape shape, ShadeType shadeType, java.awt.Color shadeColor, int width, java.awt.Shape clip, boolean round)
           
static boolean drawWebFocus(java.awt.Graphics2D g2d, javax.swing.JComponent component, FocusType focusType, int shadeWidth, int round)
          Paints web styled focus within the component
static boolean drawWebFocus(java.awt.Graphics2D g2d, javax.swing.JComponent component, FocusType focusType, int shadeWidth, int round, java.lang.Boolean mouseover)
           
static boolean drawWebFocus(java.awt.Graphics2D g2d, javax.swing.JComponent component, FocusType focusType, int shadeWidth, int round, java.lang.Boolean mouseover, java.lang.Boolean hasFocus)
           
static boolean drawWebFocus(java.awt.Graphics2D g2d, javax.swing.JComponent component, FocusType focusType, int shadeWidth, int round, java.lang.Boolean mouseover, java.lang.Boolean hasFocus, java.awt.Color color)
           
static boolean drawWebFocus(java.awt.Graphics2D g2d, javax.swing.JComponent component, FocusType focusType, int shadeWidth, int round, java.lang.Boolean mouseover, java.lang.Boolean hasFocus, java.awt.Color color, java.awt.Stroke stroke)
           
static void drawWebIconedGripper(java.awt.Graphics2D g2d, int x, int y)
           
static void drawWebIconedGripper(java.awt.Graphics2D g2d, java.awt.Point point)
           
static void drawWebIconedSelection(java.awt.Graphics2D g2d, java.awt.Rectangle selection, boolean resizableLR, boolean resizableUD, boolean drawConnectors)
           
static void drawWebIconedSelection(java.awt.Graphics2D g2d, java.awt.Rectangle selection, boolean resizableLR, boolean resizableUD, boolean drawConnectors, boolean drawSideControls)
           
static void drawWebIconedSelector(java.awt.Graphics2D g2d, java.awt.Rectangle selection, int selector)
           
static void drawWebSelection(java.awt.Graphics2D g2d, java.awt.Color color, int x, int y, int width, int height, boolean resizableLR, boolean resizableUD, boolean drawConnectors)
           
static void drawWebSelection(java.awt.Graphics2D g2d, java.awt.Color color, int x, int y, int width, int height, boolean resizableLR, boolean resizableUD, boolean drawConnectors, boolean drawSideControls)
           
static void drawWebSelection(java.awt.Graphics2D g2d, java.awt.Color color, java.awt.Rectangle selection, boolean resizableLR, boolean resizableUD, boolean drawConnectors)
           
static void drawWebSelection(java.awt.Graphics2D g2d, java.awt.Color color, java.awt.Rectangle selection, boolean resizableLR, boolean resizableUD, boolean drawConnectors, boolean drawSideControls)
           
static void drawWebSelector(java.awt.Graphics2D g2d, java.awt.Color color, java.awt.Rectangle selection, int selector)
           
static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d, javax.swing.JComponent component)
          Paints web styled border within the component with shadow and background if needed
static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d, javax.swing.JComponent component, java.awt.Color shadeColor, int shadeWidth, int round)
           
static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d, javax.swing.JComponent component, java.awt.Color shadeColor, int shadeWidth, int round, boolean fillBackground)
           
static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d, javax.swing.JComponent component, java.awt.Color shadeColor, int shadeWidth, int round, boolean fillBackground, boolean webColored)
           
static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d, javax.swing.JComponent component, java.awt.Color shadeColor, int shadeWidth, int round, boolean fillBackground, boolean webColored, java.awt.Color border)
           
static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d, javax.swing.JComponent component, java.awt.Color shadeColor, int shadeWidth, int round, boolean fillBackground, boolean webColored, java.awt.Color border, java.awt.Color disabledBorder)
           
static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d, javax.swing.JComponent component, java.awt.Color shadeColor, int shadeWidth, int round, boolean fillBackground, boolean webColored, java.awt.Color border, java.awt.Color disabledBorder, float opacity)
           
static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d, javax.swing.JComponent component, java.awt.Color shadeColor, int shadeWidth, int round, boolean fillBackground, boolean webColored, float opacity)
           
static void fillVisible(java.awt.Graphics g, javax.swing.JComponent c)
          Fills either clipped or visible rect
static void fillVisibleBackground(java.awt.Graphics g, javax.swing.JComponent c)
          Fills either clipped or visible rect with component background color if its opaque
static void firePainterChanged(javax.swing.JComponent component, Painter oldPainter, Painter newPainter)
          Fires painter property change event.
static
<T extends Painter>
T
getAdaptedPainter(Painter painter)
          Returns either the specified painter if it is not an adapted painter or the adapted painter.
static BorderMethods getBorderMethods(java.awt.Component component)
          Returns BorderMethods for the specified component or null if custom WebLaF border is not supported.
static java.awt.Rectangle getLabelEditorBounds(WebLabel label, WebTextField editor)
          Returns bounds for editor display atop of the label.
static
<T extends Painter>
T
getProperPainter(Painter painter, java.lang.Class properClass, java.lang.Class adapterClass)
          Returns the specified painter if it can be assigned to proper painter type.
static ShapeProvider getShapeProvider(java.awt.Component component)
          Returns shape provider for the specified component or null if shape provider is not supported.
static java.awt.Stroke getStroke(int width)
           
static java.awt.Stroke getStroke(int width, int cap)
           
static java.awt.Stroke getStroke(int width, int cap, int join)
           
static Styleable getStyleable(java.awt.Component component)
          Returns Styleable for the specified component or null if component is not styleable.
static java.util.Map getSystemTextHints()
           
static java.awt.Rectangle getTextBounds(java.lang.String text, java.awt.Graphics2D g2d, java.awt.Font font)
           
static java.awt.Rectangle getTextBounds(java.lang.String text, java.awt.Graphics g, java.awt.Font font)
          Determines real text size
static java.awt.Point getTextCenterShear(java.awt.FontMetrics fm, java.lang.String text)
          Returns shear to center text
static int getTextCenterShearX(java.awt.FontMetrics fm, java.lang.String text)
           
static int getTextCenterShearY(java.awt.FontMetrics fm)
           
static
<T extends javax.swing.plaf.ComponentUI>
T
getUI(java.awt.Component component)
          Returns component UI or null if UI cannot be retreived.
static java.awt.Shape getWebBorderShape(javax.swing.JComponent component, int shadeWidth, int round)
           
static java.awt.Shape getWebFocusShape(javax.swing.JComponent component, FocusType focusType, int shadeWidth, int round)
           
static java.awt.GradientPaint getWebGradientPaint(int x1, int y1, int x2, int y2)
           
static java.awt.GradientPaint getWebGradientPaint(java.awt.Rectangle bounds)
           
static java.awt.Shape intersectClip(java.awt.Graphics2D g2d, java.awt.Shape clip)
          Setting clip Shape by taking old clip Shape into account
static java.awt.Shape intersectClip(java.awt.Graphics2D g2d, java.awt.Shape clip, boolean shouldSetup)
           
static void nullifyButtonUI(javax.swing.JButton button)
          Nullifies button styles
static void paintTextEffect(java.awt.Graphics2D g2d, java.lang.String s, java.awt.Color c, int size, double tx, double ty, boolean isShadow)
           
static void paintTextGlow(java.awt.Graphics2D g2d, java.lang.String s, java.awt.Color glow)
          Draw a string with a glow effect.
static void paintTextShadow(java.awt.Graphics2D g2d, java.lang.String s)
          Draw a string with a drop shadow.
static void paintTextShadow(java.awt.Graphics2D g2d, java.lang.String s, java.awt.Color c)
          Draw a string with a drop shadow.
static void restoreAntialias(java.awt.Graphics2D g2d, java.lang.Object old)
           
static void restoreAntialias(java.awt.Graphics g, java.lang.Object old)
           
static void restoreClip(java.awt.Graphics g, java.awt.Shape clip)
           
static void restoreClip(java.awt.Graphics g, java.awt.Shape clip, boolean shouldRestore)
           
static void restoreComposite(java.awt.Graphics2D g2d, java.awt.Composite composite)
           
static void restoreComposite(java.awt.Graphics2D g2d, java.awt.Composite composite, boolean shouldRestore)
           
static void restoreFont(java.awt.Graphics g, java.awt.Font font)
           
static void restoreImageQuality(java.awt.Graphics2D g2d, java.lang.Object old)
           
static void restoreImageQuality(java.awt.Graphics g, java.lang.Object old)
           
static void restoreStroke(java.awt.Graphics2D g2d, java.awt.Stroke stroke)
           
static void restoreStroke(java.awt.Graphics2D g2d, java.awt.Stroke stroke, boolean shouldRestore)
           
static void setScrollBarStyleId(javax.swing.JScrollPane scrollPane, java.lang.String styleId)
          Sets scroll pane bars style ID.
static java.awt.Composite setupAlphaComposite(java.awt.Graphics2D g2d, java.awt.Composite composeWith, java.lang.Float alpha)
           
static java.awt.Composite setupAlphaComposite(java.awt.Graphics2D g2d, java.awt.Composite composeWith, java.lang.Float alpha, boolean shouldSetup)
           
static java.awt.Composite setupAlphaComposite(java.awt.Graphics2D g2d, java.lang.Float alpha)
          Setting AlphaComposite by taking old AlphaComposite settings into account
static java.awt.Composite setupAlphaComposite(java.awt.Graphics2D g2d, java.lang.Float alpha, boolean shouldSetup)
           
static java.lang.Object setupAntialias(java.awt.Graphics g)
          Setting antialias on
static java.lang.Object setupAntialias(java.awt.Graphics2D g2d)
           
static java.awt.Font setupFont(java.awt.Graphics g, java.awt.Font font)
          Setting font
static java.lang.Object setupImageQuality(java.awt.Graphics g)
          Setting image quality on
static java.lang.Object setupImageQuality(java.awt.Graphics2D g2d)
           
static java.awt.Stroke setupStroke(java.awt.Graphics2D g2d, java.awt.Stroke stroke)
          Setting new stroke
static java.awt.Stroke setupStroke(java.awt.Graphics2D g2d, java.awt.Stroke stroke, boolean shouldSetup)
           
static void setupSystemTextHints(java.awt.Graphics g)
           
static void setupSystemTextHints(java.awt.Graphics2D g2d)
           
static java.awt.Shape subtractClip(java.awt.Graphics g, java.awt.Shape clip)
           
static java.awt.Shape subtractClip(java.awt.Graphics g, java.awt.Shape clip, boolean shouldSetup)
           
static boolean updateBorder(java.awt.Component component)
          Attempts to update component border if border methods are available for it.
static void updateBorder(javax.swing.JComponent component, java.awt.Insets margin, Painter painter)
          Updates component border using the specified margin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

halfButton

public static int halfButton
Draws web styled selection using shapes operations. This method is pretty slow and should not be used for multiply selections presentantion


halfSelector

public static int halfSelector

halfLine

public static int halfLine

shadeWidth

public static int shadeWidth
Constructor Detail

LafUtils

public LafUtils()
Method Detail

createWebBorder

public static javax.swing.border.Border createWebBorder(java.awt.Insets insets)
Creates border for web components.


createWebBorder

public static javax.swing.border.Border createWebBorder(int top,
                                                        int left,
                                                        int bottom,
                                                        int right)

createWebBorder

public static javax.swing.border.Border createWebBorder(int margin)

getProperPainter

public static <T extends Painter> T getProperPainter(Painter painter,
                                                     java.lang.Class properClass,
                                                     java.lang.Class adapterClass)
Returns the specified painter if it can be assigned to proper painter type. Otherwise returns newly created adapter painter that wraps the specified painter. Used by component UIs to adapt general-type painters for their specific-type needs.

Type Parameters:
T - proper painter type
Parameters:
painter - processed painter
properClass - proper painter class
adapterClass - adapter painter class
Returns:
specified painter if it can be assigned to proper painter type, new painter adapter if it cannot be assigned

getAdaptedPainter

public static <T extends Painter> T getAdaptedPainter(Painter painter)
Returns either the specified painter if it is not an adapted painter or the adapted painter. Used by component UIs to retrieve painters adapted for their specific needs.

Type Parameters:
T - desired painter type
Parameters:
painter - painter to process
Returns:
either the specified painter if it is not an adapted painter or the adapted painter

firePainterChanged

public static void firePainterChanged(javax.swing.JComponent component,
                                      Painter oldPainter,
                                      Painter newPainter)
Fires painter property change event. This is a workaround since firePropertyChange() method is protected and cannot be called w/o using reflection.

Parameters:
component - component to fire property change to
oldPainter - old painter
newPainter - new painter

setScrollBarStyleId

public static void setScrollBarStyleId(javax.swing.JScrollPane scrollPane,
                                       java.lang.String styleId)
Sets scroll pane bars style ID.

Parameters:
scrollPane - scroll pane to process
styleId - scroll pane bars style ID

getUI

public static <T extends javax.swing.plaf.ComponentUI> T getUI(java.awt.Component component)
Returns component UI or null if UI cannot be retreived.

Type Parameters:
T - UI class type
Parameters:
component - component to retrieve UI from
Returns:
component UI or null if UI cannot be retreived

updateBorder

public static void updateBorder(javax.swing.JComponent component,
                                java.awt.Insets margin,
                                Painter painter)
Updates component border using the specified margin

Parameters:
component - component which border needs to be updated
margin - component margin, or null if it doesn't have one
painter - component painter, or null if it doesn't have one

fillVisibleBackground

public static void fillVisibleBackground(java.awt.Graphics g,
                                         javax.swing.JComponent c)
Fills either clipped or visible rect with component background color if its opaque


fillVisible

public static void fillVisible(java.awt.Graphics g,
                               javax.swing.JComponent c)
Fills either clipped or visible rect


nullifyButtonUI

public static void nullifyButtonUI(javax.swing.JButton button)
Nullifies button styles


createRoundedShape

public static java.awt.Shape createRoundedShape(int round,
                                                int... points)
Creates rounded shape based on its corner points


createRoundedShape

public static java.awt.Shape createRoundedShape(int round,
                                                java.awt.Point... points)

createRoundedShape

public static java.awt.Shape createRoundedShape(int round,
                                                java.awt.Point[] points,
                                                boolean[] rounded)

drawAlphaLayer

public static void drawAlphaLayer(java.awt.Graphics2D g2d,
                                  java.awt.Rectangle rectangle)
Draws alpha-background


drawAlphaLayer

public static void drawAlphaLayer(java.awt.Graphics2D g2d,
                                  int x,
                                  int y,
                                  int width,
                                  int height)

drawAlphaLayer

public static void drawAlphaLayer(java.awt.Graphics2D g2d,
                                  java.awt.Rectangle rectangle,
                                  int size)

drawAlphaLayer

public static void drawAlphaLayer(java.awt.Graphics2D g2d,
                                  int x,
                                  int y,
                                  int width,
                                  int height,
                                  int size)

drawAlphaLayer

public static void drawAlphaLayer(java.awt.Graphics2D g2d,
                                  java.awt.Rectangle rectangle,
                                  int size,
                                  java.awt.Color light,
                                  java.awt.Color dark)

drawAlphaLayer

public static void drawAlphaLayer(java.awt.Graphics2D g2d,
                                  int x,
                                  int y,
                                  int width,
                                  int height,
                                  int size,
                                  java.awt.Color light,
                                  java.awt.Color dark)

intersectClip

public static java.awt.Shape intersectClip(java.awt.Graphics2D g2d,
                                           java.awt.Shape clip)
Setting clip Shape by taking old clip Shape into account


intersectClip

public static java.awt.Shape intersectClip(java.awt.Graphics2D g2d,
                                           java.awt.Shape clip,
                                           boolean shouldSetup)

subtractClip

public static java.awt.Shape subtractClip(java.awt.Graphics g,
                                          java.awt.Shape clip)

subtractClip

public static java.awt.Shape subtractClip(java.awt.Graphics g,
                                          java.awt.Shape clip,
                                          boolean shouldSetup)

restoreClip

public static void restoreClip(java.awt.Graphics g,
                               java.awt.Shape clip)

restoreClip

public static void restoreClip(java.awt.Graphics g,
                               java.awt.Shape clip,
                               boolean shouldRestore)

setupStroke

public static java.awt.Stroke setupStroke(java.awt.Graphics2D g2d,
                                          java.awt.Stroke stroke)
Setting new stroke


setupStroke

public static java.awt.Stroke setupStroke(java.awt.Graphics2D g2d,
                                          java.awt.Stroke stroke,
                                          boolean shouldSetup)

restoreStroke

public static void restoreStroke(java.awt.Graphics2D g2d,
                                 java.awt.Stroke stroke)

restoreStroke

public static void restoreStroke(java.awt.Graphics2D g2d,
                                 java.awt.Stroke stroke,
                                 boolean shouldRestore)

setupImageQuality

public static java.lang.Object setupImageQuality(java.awt.Graphics g)
Setting image quality on


setupImageQuality

public static java.lang.Object setupImageQuality(java.awt.Graphics2D g2d)

restoreImageQuality

public static void restoreImageQuality(java.awt.Graphics g,
                                       java.lang.Object old)

restoreImageQuality

public static void restoreImageQuality(java.awt.Graphics2D g2d,
                                       java.lang.Object old)

setupFont

public static java.awt.Font setupFont(java.awt.Graphics g,
                                      java.awt.Font font)
Setting font


restoreFont

public static void restoreFont(java.awt.Graphics g,
                               java.awt.Font font)

setupAntialias

public static java.lang.Object setupAntialias(java.awt.Graphics g)
Setting antialias on


setupAntialias

public static java.lang.Object setupAntialias(java.awt.Graphics2D g2d)

disableAntialias

public static java.lang.Object disableAntialias(java.awt.Graphics g)

disableAntialias

public static java.lang.Object disableAntialias(java.awt.Graphics2D g2d)

restoreAntialias

public static void restoreAntialias(java.awt.Graphics g,
                                    java.lang.Object old)

restoreAntialias

public static void restoreAntialias(java.awt.Graphics2D g2d,
                                    java.lang.Object old)

getSystemTextHints

public static java.util.Map getSystemTextHints()

setupSystemTextHints

public static void setupSystemTextHints(java.awt.Graphics g)

setupSystemTextHints

public static void setupSystemTextHints(java.awt.Graphics2D g2d)

setupAlphaComposite

public static java.awt.Composite setupAlphaComposite(java.awt.Graphics2D g2d,
                                                     java.lang.Float alpha)
Setting AlphaComposite by taking old AlphaComposite settings into account


setupAlphaComposite

public static java.awt.Composite setupAlphaComposite(java.awt.Graphics2D g2d,
                                                     java.lang.Float alpha,
                                                     boolean shouldSetup)

setupAlphaComposite

public static java.awt.Composite setupAlphaComposite(java.awt.Graphics2D g2d,
                                                     java.awt.Composite composeWith,
                                                     java.lang.Float alpha)

setupAlphaComposite

public static java.awt.Composite setupAlphaComposite(java.awt.Graphics2D g2d,
                                                     java.awt.Composite composeWith,
                                                     java.lang.Float alpha,
                                                     boolean shouldSetup)

restoreComposite

public static void restoreComposite(java.awt.Graphics2D g2d,
                                    java.awt.Composite composite)

restoreComposite

public static void restoreComposite(java.awt.Graphics2D g2d,
                                    java.awt.Composite composite,
                                    boolean shouldRestore)

getTextBounds

public static java.awt.Rectangle getTextBounds(java.lang.String text,
                                               java.awt.Graphics g,
                                               java.awt.Font font)
Determines real text size


getTextBounds

public static java.awt.Rectangle getTextBounds(java.lang.String text,
                                               java.awt.Graphics2D g2d,
                                               java.awt.Font font)

drawWebStyle

public static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d,
                                          javax.swing.JComponent component)
Paints web styled border within the component with shadow and background if needed


drawWebStyle

public static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d,
                                          javax.swing.JComponent component,
                                          java.awt.Color shadeColor,
                                          int shadeWidth,
                                          int round)

drawWebStyle

public static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d,
                                          javax.swing.JComponent component,
                                          java.awt.Color shadeColor,
                                          int shadeWidth,
                                          int round,
                                          boolean fillBackground)

drawWebStyle

public static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d,
                                          javax.swing.JComponent component,
                                          java.awt.Color shadeColor,
                                          int shadeWidth,
                                          int round,
                                          boolean fillBackground,
                                          boolean webColored)

drawWebStyle

public static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d,
                                          javax.swing.JComponent component,
                                          java.awt.Color shadeColor,
                                          int shadeWidth,
                                          int round,
                                          boolean fillBackground,
                                          boolean webColored,
                                          float opacity)

drawWebStyle

public static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d,
                                          javax.swing.JComponent component,
                                          java.awt.Color shadeColor,
                                          int shadeWidth,
                                          int round,
                                          boolean fillBackground,
                                          boolean webColored,
                                          java.awt.Color border)

drawWebStyle

public static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d,
                                          javax.swing.JComponent component,
                                          java.awt.Color shadeColor,
                                          int shadeWidth,
                                          int round,
                                          boolean fillBackground,
                                          boolean webColored,
                                          java.awt.Color border,
                                          java.awt.Color disabledBorder)

drawWebStyle

public static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d,
                                          javax.swing.JComponent component,
                                          java.awt.Color shadeColor,
                                          int shadeWidth,
                                          int round,
                                          boolean fillBackground,
                                          boolean webColored,
                                          java.awt.Color border,
                                          java.awt.Color disabledBorder,
                                          float opacity)

getWebGradientPaint

public static java.awt.GradientPaint getWebGradientPaint(java.awt.Rectangle bounds)

getWebGradientPaint

public static java.awt.GradientPaint getWebGradientPaint(int x1,
                                                         int y1,
                                                         int x2,
                                                         int y2)

getWebBorderShape

public static java.awt.Shape getWebBorderShape(javax.swing.JComponent component,
                                               int shadeWidth,
                                               int round)

drawCustomWebBorder

public static void drawCustomWebBorder(java.awt.Graphics2D g2d,
                                       javax.swing.JComponent component,
                                       java.awt.Shape borderShape,
                                       java.awt.Color shadeColor,
                                       int shadeWidth,
                                       boolean fillBackground,
                                       boolean webColored)
Paints custom shaped web styled border within the component with shadow and background


drawCustomWebBorder

public static void drawCustomWebBorder(java.awt.Graphics2D g2d,
                                       javax.swing.JComponent component,
                                       java.awt.Shape borderShape,
                                       java.awt.Color shadeColor,
                                       int shadeWidth,
                                       boolean fillBackground,
                                       boolean webColored,
                                       java.awt.Color border,
                                       java.awt.Color disabledBorder)

drawWebFocus

public static boolean drawWebFocus(java.awt.Graphics2D g2d,
                                   javax.swing.JComponent component,
                                   FocusType focusType,
                                   int shadeWidth,
                                   int round)
Paints web styled focus within the component


drawWebFocus

public static boolean drawWebFocus(java.awt.Graphics2D g2d,
                                   javax.swing.JComponent component,
                                   FocusType focusType,
                                   int shadeWidth,
                                   int round,
                                   java.lang.Boolean mouseover)

drawWebFocus

public static boolean drawWebFocus(java.awt.Graphics2D g2d,
                                   javax.swing.JComponent component,
                                   FocusType focusType,
                                   int shadeWidth,
                                   int round,
                                   java.lang.Boolean mouseover,
                                   java.lang.Boolean hasFocus)

drawWebFocus

public static boolean drawWebFocus(java.awt.Graphics2D g2d,
                                   javax.swing.JComponent component,
                                   FocusType focusType,
                                   int shadeWidth,
                                   int round,
                                   java.lang.Boolean mouseover,
                                   java.lang.Boolean hasFocus,
                                   java.awt.Color color)

drawWebFocus

public static boolean drawWebFocus(java.awt.Graphics2D g2d,
                                   javax.swing.JComponent component,
                                   FocusType focusType,
                                   int shadeWidth,
                                   int round,
                                   java.lang.Boolean mouseover,
                                   java.lang.Boolean hasFocus,
                                   java.awt.Color color,
                                   java.awt.Stroke stroke)

getWebFocusShape

public static java.awt.Shape getWebFocusShape(javax.swing.JComponent component,
                                              FocusType focusType,
                                              int shadeWidth,
                                              int round)

drawCustomWebFocus

public static void drawCustomWebFocus(java.awt.Graphics2D g2d,
                                      javax.swing.JComponent component,
                                      FocusType focusType,
                                      java.awt.Shape shape)
Draws custom shaped web styled focus within the component


drawCustomWebFocus

public static void drawCustomWebFocus(java.awt.Graphics2D g2d,
                                      javax.swing.JComponent component,
                                      FocusType focusType,
                                      java.awt.Shape shape,
                                      java.lang.Boolean mouseover)

drawCustomWebFocus

public static void drawCustomWebFocus(java.awt.Graphics2D g2d,
                                      javax.swing.JComponent component,
                                      FocusType focusType,
                                      java.awt.Shape shape,
                                      java.lang.Boolean mouseover,
                                      java.lang.Boolean hasFocus)

drawShade

public static void drawShade(java.awt.Graphics2D g2d,
                             java.awt.Shape shape,
                             java.awt.Color shadeColor,
                             int width)
Draws web styled shade using specified shape


drawShade

public static void drawShade(java.awt.Graphics2D g2d,
                             java.awt.Shape shape,
                             ShadeType shadeType,
                             java.awt.Color shadeColor,
                             int width)

drawShade

public static void drawShade(java.awt.Graphics2D g2d,
                             java.awt.Shape shape,
                             java.awt.Color shadeColor,
                             int width,
                             java.awt.Shape clip)

drawShade

public static void drawShade(java.awt.Graphics2D g2d,
                             java.awt.Shape shape,
                             ShadeType shadeType,
                             java.awt.Color shadeColor,
                             int width,
                             java.awt.Shape clip)

drawShade

public static void drawShade(java.awt.Graphics2D g2d,
                             java.awt.Shape shape,
                             java.awt.Color shadeColor,
                             int width,
                             boolean round)

drawShade

public static void drawShade(java.awt.Graphics2D g2d,
                             java.awt.Shape shape,
                             ShadeType shadeType,
                             java.awt.Color shadeColor,
                             int width,
                             boolean round)

drawShade

public static void drawShade(java.awt.Graphics2D g2d,
                             java.awt.Shape shape,
                             java.awt.Color shadeColor,
                             int width,
                             java.awt.Shape clip,
                             boolean round)

drawShade

public static void drawShade(java.awt.Graphics2D g2d,
                             java.awt.Shape shape,
                             ShadeType shadeType,
                             java.awt.Color shadeColor,
                             int width,
                             java.awt.Shape clip,
                             boolean round)

getStroke

public static java.awt.Stroke getStroke(int width)

getStroke

public static java.awt.Stroke getStroke(int width,
                                        int cap)

getStroke

public static java.awt.Stroke getStroke(int width,
                                        int cap,
                                        int join)

drawWebSelection

public static void drawWebSelection(java.awt.Graphics2D g2d,
                                    java.awt.Color color,
                                    int x,
                                    int y,
                                    int width,
                                    int height,
                                    boolean resizableLR,
                                    boolean resizableUD,
                                    boolean drawConnectors)

drawWebSelection

public static void drawWebSelection(java.awt.Graphics2D g2d,
                                    java.awt.Color color,
                                    int x,
                                    int y,
                                    int width,
                                    int height,
                                    boolean resizableLR,
                                    boolean resizableUD,
                                    boolean drawConnectors,
                                    boolean drawSideControls)

drawWebSelection

public static void drawWebSelection(java.awt.Graphics2D g2d,
                                    java.awt.Color color,
                                    java.awt.Rectangle selection,
                                    boolean resizableLR,
                                    boolean resizableUD,
                                    boolean drawConnectors)

drawWebSelection

public static void drawWebSelection(java.awt.Graphics2D g2d,
                                    java.awt.Color color,
                                    java.awt.Rectangle selection,
                                    boolean resizableLR,
                                    boolean resizableUD,
                                    boolean drawConnectors,
                                    boolean drawSideControls)

drawWebSelector

public static void drawWebSelector(java.awt.Graphics2D g2d,
                                   java.awt.Color color,
                                   java.awt.Rectangle selection,
                                   int selector)

drawWebIconedSelection

public static void drawWebIconedSelection(java.awt.Graphics2D g2d,
                                          java.awt.Rectangle selection,
                                          boolean resizableLR,
                                          boolean resizableUD,
                                          boolean drawConnectors)

drawWebIconedSelection

public static void drawWebIconedSelection(java.awt.Graphics2D g2d,
                                          java.awt.Rectangle selection,
                                          boolean resizableLR,
                                          boolean resizableUD,
                                          boolean drawConnectors,
                                          boolean drawSideControls)

drawWebIconedSelector

public static void drawWebIconedSelector(java.awt.Graphics2D g2d,
                                         java.awt.Rectangle selection,
                                         int selector)

drawWebIconedGripper

public static void drawWebIconedGripper(java.awt.Graphics2D g2d,
                                        java.awt.Point point)

drawWebIconedGripper

public static void drawWebIconedGripper(java.awt.Graphics2D g2d,
                                        int x,
                                        int y)

drawEtchedShape

public static void drawEtchedShape(java.awt.Graphics2D g2d,
                                   java.awt.image.BufferedImage topBg,
                                   java.awt.image.BufferedImage bottomBg,
                                   java.awt.Shape fullShape,
                                   java.awt.Shape bevelShape)
Draws etched shape with specified background colors


paintTextShadow

public static void paintTextShadow(java.awt.Graphics2D g2d,
                                   java.lang.String s)
Draw a string with a drop shadow. The light angle is assumed to be 0 degrees, (i.e., window is illuminated from top) and the shadow size is 2, with a 1 pixel vertical displacement. The shadow is intended to be subtle to be usable in as many text components as possible. The shadow is generated with multiple calls to draw string. This method paints the text on coordinates 0, 1. If text should be painted elsewhere, a transform should be applied to the graphics before passing it.


paintTextShadow

public static void paintTextShadow(java.awt.Graphics2D g2d,
                                   java.lang.String s,
                                   java.awt.Color c)
Draw a string with a drop shadow. The light angle is assumed to be 0 degrees, (i.e., window is illuminated from top) and the shadow size is 2, with a 1 pixel vertical displacement. The shadow is intended to be subtle to be usable in as many text components as possible. The shadow is generated with multiple calls to draw string. This method paints the text on coordinates 0, 1. If text should be painted elsewhere, a transform should be applied to the graphics before passing it.


paintTextGlow

public static void paintTextGlow(java.awt.Graphics2D g2d,
                                 java.lang.String s,
                                 java.awt.Color glow)
Draw a string with a glow effect. Glow differs from a drop shadow in that it isn't offset in any direction (i.e., not affected by "lighting conditions").


paintTextEffect

public static void paintTextEffect(java.awt.Graphics2D g2d,
                                   java.lang.String s,
                                   java.awt.Color c,
                                   int size,
                                   double tx,
                                   double ty,
                                   boolean isShadow)

drawDashedRect

public static void drawDashedRect(java.awt.Graphics2D g2d,
                                  int x1,
                                  int y1,
                                  int x2,
                                  int y2,
                                  int stripeLength,
                                  int spaceLength)
Draws dashed rectangle


drawDashedRect

public static void drawDashedRect(java.awt.Graphics2D g2d,
                                  int x1,
                                  int y1,
                                  int x2,
                                  int y2,
                                  int stripeLength,
                                  int spaceLength,
                                  float stripeStart)

createRoundedRectShape

public static java.awt.geom.GeneralPath createRoundedRectShape(int x,
                                                               int y,
                                                               int w,
                                                               int h,
                                                               int arcW,
                                                               int arcH)
Returns custom rounded rectangle shape


getTextCenterShear

public static java.awt.Point getTextCenterShear(java.awt.FontMetrics fm,
                                                java.lang.String text)
Returns shear to center text


getTextCenterShearX

public static int getTextCenterShearX(java.awt.FontMetrics fm,
                                      java.lang.String text)

getTextCenterShearY

public static int getTextCenterShearY(java.awt.FontMetrics fm)

updateBorder

public static boolean updateBorder(java.awt.Component component)
Attempts to update component border if border methods are available for it. Returns whether attempt has succeed or not.

Parameters:
component - component which border should be updated
Returns:
true if attempt has succeed, false otherwise

getBorderMethods

public static BorderMethods getBorderMethods(java.awt.Component component)
Returns BorderMethods for the specified component or null if custom WebLaF border is not supported.

Parameters:
component - component to process
Returns:
BorderMethods for the specified component or null if custom WebLaF border is not supported

getShapeProvider

public static ShapeProvider getShapeProvider(java.awt.Component component)
Returns shape provider for the specified component or null if shape provider is not supported. This might be used to provide dynamic component shape to other components.

Parameters:
component - component to process
Returns:
shape provider for the specified component or null if shape provider is not supported

getStyleable

public static Styleable getStyleable(java.awt.Component component)
Returns Styleable for the specified component or null if component is not styleable.

Parameters:
component - component to process
Returns:
Styleable for the specified component or null if component is not styleable

getLabelEditorBounds

public static java.awt.Rectangle getLabelEditorBounds(WebLabel label,
                                                      WebTextField editor)
Returns bounds for editor display atop of the label.

Parameters:
label - edited label
editor - label editor field
Returns:
bounds for editor display atop of the label