public class RoundBorder extends Border
A border that can either be a circle or a circular rectangle which is a rectangle whose sides are circles. This border can optionally have a drop shadow associated with it.
IMPORTANT: RoundRectBorder
instances can't be reused
you would need to create a separate instance for each style object!
See this issue for further details.
Modifier and Type | Method and Description |
---|---|
RoundBorder |
color(int color)
Sets the background color of the circle/rectangle
|
static RoundBorder |
create()
Creates a flat round border with no stroke and no shadow and the default color, this call can
be chained with the other calls to mutate the color/opacity etc.
|
boolean |
equals(Object obj)
{Indicates whether some other object is "equal to" this one.}
|
int |
getColor()
The color of the border background
|
int |
getMinimumHeight()
Returns the minimum size required to properly display this border, normally this
is 0 but a border might deem itself undisplayable with too small a size e.g.
|
int |
getMinimumWidth()
Returns the minimum size required to properly display this border, normally this
is 0 but a border might deem itself undisplayable with too small a size e.g.
|
int |
getOpacity()
The opacity (transparency) of the border background
|
float |
getShadowBlur()
The Gaussian blur size
|
int |
getShadowOpacity()
The opacity of the shadow between 0 and 255
|
int |
getShadowSpread()
The spread of the shadow in pixels of millimeters
|
float |
getShadowX()
X axis bias of the shadow between 0 and 1 where 0 is to the top and 1 is to the bottom, defaults to 0.5
|
float |
getShadowY()
Y axis bias of the shadow between 0 and 1 where 0 is to the left and 1 is to the right, defaults to 0.5
|
int |
getStrokeColor()
The color of the edge of the border if applicable
|
int |
getStrokeOpacity()
The opacity of the edge of the border if applicable
|
float |
getStrokeThickness()
The thickness of the edge of the border if applicable, 0 if no stroke is needed
|
boolean |
getUIID()
True is we use the background of the component setting to draw
|
boolean |
isBackgroundPainter()
Returns true if installing this border will override the painting of the component background
|
boolean |
isOnlyLeftRounded()
Checks if only left side is rounded.
|
boolean |
isOnlyRightRounded()
Checks if only right side is rounded.
|
boolean |
isRectangle()
True if this border grows into a rectangle horizontally or keeps growing as a circle
|
boolean |
isShadowMM()
True if the shadow spread is in millimeters
|
boolean |
isStrokeMM()
True if the thickness of the stroke is in millimeters
|
RoundBorder |
onlyLeftRounded(boolean onlyLeftRounded)
Forces a special case of the rectangle mode that renders the right side as
square.
|
RoundBorder |
onlyRightRounded(boolean onlyRightRounded)
Forces a special case of the rectangle mode that renders the left side as
square.
|
RoundBorder |
opacity(int opacity)
Sets the background opacity of the circle/rectangle
|
void |
paintBorderBackground(Graphics g,
Component c)
Has effect when the border demands responsibility for background painting
normally the painter will perform this work but in this case the border might
do it instead.
|
RoundBorder |
rectangle(boolean rectangle)
When set to true this border grows into a rectangle when the space isn't perfectly circular
|
RoundBorder |
shadowBlur(float shadowBlur)
The blur on the shadow this is the standard Gaussian blur radius
|
RoundBorder |
shadowOpacity(int shadowOpacity)
Sets the opacity of the shadow from 0 - 255 where 0 means no shadow and 255 means opaque black shadow
|
RoundBorder |
shadowSpread(int shadowSpread)
Sets the spread in pixels of the shadow i.e how much bigger is it than the actual circle/rectangle
|
RoundBorder |
shadowSpread(int shadowSpread,
boolean mm)
Sets the spread in pixels of the shadow i.e how much bigger is it than the actual circle/rectangle
|
RoundBorder |
shadowX(float shadowX)
The position of the shadow on the X axis where 0.5f means the center and higher values draw it to the right side
|
RoundBorder |
shadowY(float shadowY)
The position of the shadow on the Y axis where 0.5f means the center and higher values draw it to the bottom
|
RoundBorder |
stroke(float stroke,
boolean mm)
Sets the stroke of the circle/rectangle
|
RoundBorder |
stroke(Stroke stroke)
Sets the stroke of the circle/rectangle
|
RoundBorder |
strokeAngle(int strokeAngle)
Sets the stroke angle of the circle, this only applies to circular versions
|
RoundBorder |
strokeColor(int strokeColor)
Sets the stroke color of the circle/rectangle
|
RoundBorder |
strokeOpacity(int strokeOpacity)
Sets the opacity of the stroke line around the circle/rectangle
|
RoundBorder |
uiid(boolean uiid)
Uses the style of the components UIID to draw the background of the border, this effectively overrides all
other style settings but allows the full power of UIID drawing including gradients, background images
etc.
|
addOuterBorder, clearImageBorderSpecialTile, createBevelLowered, createBevelLowered, createBevelRaised, createBevelRaised, createCompoundBorder, createDashedBorder, createDashedBorder, createDottedBorder, createDottedBorder, createDoubleBorder, createDoubleBorder, createEmpty, createEtchedLowered, createEtchedLowered, createEtchedRaised, createEtchedRaised, createGrooveBorder, createGrooveBorder, createHorizonalImageBorder, createImageBorder, createImageBorder, createImageScaledBorder, createImageSplicedBorder, createInsetBorder, createInsetBorder, createLineBorder, createLineBorder, createLineBorder, createLineBorder, createLineBorder, createLineBorder, createOutsetBorder, createOutsetBorder, createPressedVersion, createRidgeBorder, createRidgeBorder, createRoundBorder, createRoundBorder, createRoundBorder, createRoundBorder, createUndelineBorder, createUndelineBorder, createUnderlineBorder, createUnderlineBorder, createUnderlineBorder, createUnderlineBorder, createVerticalImageBorder, getCompoundBorders, getDefaultBorder, getEmpty, getFocusedInstance, getPressedInstance, getProperty, getThickness, getTrackComponent, isEmptyBorder, isPaintOuterBorderFirst, isRectangleType, lock, mirrorBorder, paint, setDefaultBorder, setFocusedInstance, setImageBorderSpecialTile, setImageBorderSpecialTile, setPaintOuterBorderFirst, setPressedInstance, setThickness, setTrackComponent, setTrackComponent, unlock
public static RoundBorder create()
public RoundBorder uiid(boolean uiid)
Uses the style of the components UIID to draw the background of the border, this effectively overrides all other style settings but allows the full power of UIID drawing including gradients, background images etc.
Notice: this flag will only work when shaped clipping is supported. That feature isn't available in all platforms...
uiid
- true to use the background of the component settingpublic boolean getUIID()
public RoundBorder color(int color)
color
- the colorpublic RoundBorder opacity(int opacity)
opacity
- the background opacity from 0-255 where 255 is completely opaquepublic RoundBorder strokeOpacity(int strokeOpacity)
strokeOpacity
- the opacity from 0-255 where 255 is completely opaquepublic RoundBorder strokeColor(int strokeColor)
strokeColor
- the colorpublic RoundBorder stroke(Stroke stroke)
stroke
- the stroke objectpublic RoundBorder stroke(float stroke, boolean mm)
stroke
- the thickness of the stroke objectmm
- set to true to indicate the value is in millimeters, false indicates pixelspublic RoundBorder strokeAngle(int strokeAngle)
strokeAngle
- the stroke angle in degreespublic RoundBorder shadowSpread(int shadowSpread, boolean mm)
shadowSpread
- the amount in pixels representing the size of the shadowmm
- set to true to indicate the value is in millimeters, false indicates pixelspublic RoundBorder shadowSpread(int shadowSpread)
shadowSpread
- the amount in pixels representing the size of the shadowpublic RoundBorder shadowOpacity(int shadowOpacity)
shadowOpacity
- the opacity of the shadowpublic RoundBorder shadowX(float shadowX)
shadowX
- the position of the shadow between 0 - 1 where 0 equals left and 1 equals rightpublic RoundBorder shadowY(float shadowY)
shadowY
- the position of the shadow between 0 - 1 where 0 equals top and 1 equals bottompublic RoundBorder shadowBlur(float shadowBlur)
shadowBlur
- The blur on the shadow this is the standard Gaussian blur radiuspublic RoundBorder rectangle(boolean rectangle)
rectangle
- When set to true this border grows into a rectangle when the space isn't perfectly circularpublic RoundBorder onlyLeftRounded(boolean onlyLeftRounded)
onlyLeftRounded
- the new state of this modepublic boolean isOnlyLeftRounded()
public RoundBorder onlyRightRounded(boolean onlyRightRounded)
onlyRightRounded
- the new state of this modepublic boolean isOnlyRightRounded()
public void paintBorderBackground(Graphics g, Component c)
Border
paintBorderBackground
in class Border
g
- graphics context to draw ontoc
- component whose border should be drawnpublic int getMinimumHeight()
Border
getMinimumHeight
in class Border
public int getMinimumWidth()
Border
getMinimumWidth
in class Border
public boolean isBackgroundPainter()
Border
isBackgroundPainter
in class Border
public int getColor()
public int getOpacity()
public int getStrokeColor()
public int getStrokeOpacity()
public float getStrokeThickness()
public boolean isStrokeMM()
public int getShadowSpread()
public int getShadowOpacity()
public float getShadowX()
public float getShadowY()
public float getShadowBlur()
public boolean isShadowMM()
public boolean isRectangle()
public boolean equals(Object obj)
Border