|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.alee.utils.LafUtils
public final class LafUtils
This class provides a set of utilities for core WebLaF components. Created mostly for internal usage within WebLaF.
Field Summary | |
---|---|
static int |
halfButton
Draws web styled selection using shapes operations. |
static int |
halfLine
|
static int |
halfSelector
|
static java.awt.geom.AffineTransform |
moveDown
|
static java.awt.geom.AffineTransform |
moveLeft
Predefined transforms to move shapes or painting 1px l/r/u/d. |
static java.awt.geom.AffineTransform |
moveRight
|
static java.awt.geom.AffineTransform |
moveUp
|
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 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 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
|
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
|
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 Styleable |
getStyleable(java.awt.Component component)
Returns Styleable for the specified component or null if component is not styleable. |
|
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
|
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 TexturePainter |
loadTexturePainter(java.lang.Object source)
Returns TexturePainter which is read from the source. |
|
static TexturePainter |
loadTexturePainter(ResourceFile resource)
Returns TexturePainter which is read from specified ResourceFile. |
|
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 |
setScrollBarStyleId(javax.swing.JScrollPane scrollPane,
java.lang.String styleId)
Sets scroll pane bars style ID. |
|
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 |
---|
public static final java.awt.geom.AffineTransform moveLeft
public static final java.awt.geom.AffineTransform moveRight
public static final java.awt.geom.AffineTransform moveUp
public static final java.awt.geom.AffineTransform moveDown
public static int halfButton
public static int halfSelector
public static int halfLine
public static int shadeWidth
Constructor Detail |
---|
public LafUtils()
Method Detail |
---|
public static javax.swing.border.Border createWebBorder(java.awt.Insets insets)
public static javax.swing.border.Border createWebBorder(int top, int left, int bottom, int right)
public static javax.swing.border.Border createWebBorder(int margin)
public static <T extends Painter> T getProperPainter(Painter painter, java.lang.Class properClass, java.lang.Class adapterClass)
T
- proper painter typepainter
- processed painterproperClass
- proper painter classadapterClass
- adapter painter class
public static <T extends Painter> T getAdaptedPainter(Painter painter)
T
- desired painter typepainter
- painter to process
public static void firePainterChanged(javax.swing.JComponent component, Painter oldPainter, Painter newPainter)
firePropertyChange()
method is protected and cannot be called w/o using reflection.
component
- component to fire property change tooldPainter
- old painternewPainter
- new painterpublic static void setScrollBarStyleId(javax.swing.JScrollPane scrollPane, java.lang.String styleId)
scrollPane
- scroll pane to processstyleId
- scroll pane bars style IDpublic static <T extends javax.swing.plaf.ComponentUI> T getUI(java.awt.Component component)
T
- UI class typecomponent
- component to retrieve UI from
public static void updateBorder(javax.swing.JComponent component, java.awt.Insets margin, Painter painter)
component
- component which border needs to be updatedmargin
- component margin, or null if it doesn't have onepainter
- component painter, or null if it doesn't have onepublic static void fillVisibleBackground(java.awt.Graphics g, javax.swing.JComponent c)
public static void fillVisible(java.awt.Graphics g, javax.swing.JComponent c)
public static void nullifyButtonUI(javax.swing.JButton button)
public static java.awt.Shape createRoundedShape(int round, int... points)
public static java.awt.Shape createRoundedShape(int round, java.awt.Point... points)
public static java.awt.Shape createRoundedShape(int round, java.awt.Point[] points, boolean[] rounded)
public static void drawAlphaLayer(java.awt.Graphics2D g2d, java.awt.Rectangle rectangle)
public static void drawAlphaLayer(java.awt.Graphics2D g2d, int x, int y, int width, int height)
public static void drawAlphaLayer(java.awt.Graphics2D g2d, java.awt.Rectangle rectangle, int size)
public static void drawAlphaLayer(java.awt.Graphics2D g2d, int x, int y, int width, int height, int size)
public static void drawAlphaLayer(java.awt.Graphics2D g2d, java.awt.Rectangle rectangle, int size, java.awt.Color light, java.awt.Color dark)
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)
public static java.awt.Rectangle getTextBounds(java.lang.String text, java.awt.Graphics g, java.awt.Font font)
public static java.awt.Rectangle getTextBounds(java.lang.String text, java.awt.Graphics2D g2d, java.awt.Font font)
public static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d, javax.swing.JComponent component)
public static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d, javax.swing.JComponent component, java.awt.Color shadeColor, int shadeWidth, int round)
public static java.awt.Shape drawWebStyle(java.awt.Graphics2D g2d, javax.swing.JComponent component, java.awt.Color shadeColor, int shadeWidth, int round, boolean fillBackground)
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)
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)
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)
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)
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)
public static java.awt.GradientPaint getWebGradientPaint(java.awt.Rectangle bounds)
public static java.awt.GradientPaint getWebGradientPaint(int x1, int y1, int x2, int y2)
public static java.awt.Shape getWebBorderShape(javax.swing.JComponent component, int shadeWidth, int round)
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)
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)
public static boolean drawWebFocus(java.awt.Graphics2D g2d, javax.swing.JComponent component, FocusType focusType, int shadeWidth, int round)
public static boolean drawWebFocus(java.awt.Graphics2D g2d, javax.swing.JComponent component, FocusType focusType, int shadeWidth, int round, java.lang.Boolean mouseover)
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)
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)
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)
public static java.awt.Shape getWebFocusShape(javax.swing.JComponent component, FocusType focusType, int shadeWidth, int round)
public static void drawCustomWebFocus(java.awt.Graphics2D g2d, javax.swing.JComponent component, FocusType focusType, java.awt.Shape shape)
public static void drawCustomWebFocus(java.awt.Graphics2D g2d, javax.swing.JComponent component, FocusType focusType, java.awt.Shape shape, java.lang.Boolean mouseover)
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)
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)
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)
public static void drawWebSelection(java.awt.Graphics2D g2d, java.awt.Color color, java.awt.Rectangle selection, boolean resizableLR, boolean resizableUD, boolean drawConnectors)
public static void drawWebSelection(java.awt.Graphics2D g2d, java.awt.Color color, java.awt.Rectangle selection, boolean resizableLR, boolean resizableUD, boolean drawConnectors, boolean drawSideControls)
public static void drawWebSelector(java.awt.Graphics2D g2d, java.awt.Color color, java.awt.Rectangle selection, int selector)
public static void drawWebIconedSelection(java.awt.Graphics2D g2d, java.awt.Rectangle selection, boolean resizableLR, boolean resizableUD, boolean drawConnectors)
public static void drawWebIconedSelection(java.awt.Graphics2D g2d, java.awt.Rectangle selection, boolean resizableLR, boolean resizableUD, boolean drawConnectors, boolean drawSideControls)
public static void drawWebIconedSelector(java.awt.Graphics2D g2d, java.awt.Rectangle selection, int selector)
public static void drawWebIconedGripper(java.awt.Graphics2D g2d, java.awt.Point point)
public static void drawWebIconedGripper(java.awt.Graphics2D g2d, int x, int y)
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)
public static void paintTextShadow(java.awt.Graphics2D g2d, java.lang.String s)
public static void paintTextShadow(java.awt.Graphics2D g2d, java.lang.String s, java.awt.Color c)
public static void paintTextGlow(java.awt.Graphics2D g2d, java.lang.String s, java.awt.Color glow)
public static void paintTextEffect(java.awt.Graphics2D g2d, java.lang.String s, java.awt.Color c, int size, double tx, double ty, boolean isShadow)
public static void drawDashedRect(java.awt.Graphics2D g2d, int x1, int y1, int x2, int y2, int stripeLength, int spaceLength)
public static void drawDashedRect(java.awt.Graphics2D g2d, int x1, int y1, int x2, int y2, int stripeLength, int spaceLength, float stripeStart)
public static java.awt.geom.GeneralPath createRoundedRectShape(int x, int y, int w, int h, int arcW, int arcH)
public static java.awt.Point getTextCenterShear(java.awt.FontMetrics fm, java.lang.String text)
public static int getTextCenterShearX(java.awt.FontMetrics fm, java.lang.String text)
public static int getTextCenterShearY(java.awt.FontMetrics fm)
public static boolean updateBorder(java.awt.Component component)
component
- component which border should be updated
public static BorderMethods getBorderMethods(java.awt.Component component)
component
- component to process
public static ShapeProvider getShapeProvider(java.awt.Component component)
component
- component to process
public static Styleable getStyleable(java.awt.Component component)
component
- component to process
public static java.awt.Rectangle getLabelEditorBounds(WebLabel label, WebTextField editor)
label
- edited labeleditor
- label editor field
public static TexturePainter loadTexturePainter(java.lang.Object source)
source
- one of possible sources: URL, String, File, Reader, InputStream
public static TexturePainter loadTexturePainter(ResourceFile resource)
resource
- file description
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |