public class RoundRectBorder extends Border
Customizable rounded rectangle border that breaks down the border into customizable pieces. The background is inherited from the parent UIID but stroke and shadow can be customized via user settings.
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 |
---|---|
RoundRectBorder |
arrowSize(float size)
Change the size of the arrow used for component tracking.
|
RoundRectBorder |
bezierCorners(boolean bezierCorners)
True if the corners are Bezier curves, otherwise the corners are drawn as a regular arc
|
RoundRectBorder |
bottomLeftMode(boolean bottomLeft)
True to draw the bottom left corner rounded, false to draw it as a corner
|
RoundRectBorder |
bottomOnlyMode(boolean bottomOnlyMode)
Special mode where only the bottom of the round rectangle is rounded and the top is a regular rectangle
|
RoundRectBorder |
bottomRightMode(boolean bottomRight)
True to draw the bottom right corner rounded, false to draw it as a corner
|
RoundRectBorder |
cornerRadius(float cornerRadius)
The radius of the corners in millimeters
|
static RoundRectBorder |
create()
Creates a flat border with styles derived from the component UIID
|
boolean |
equals(Object obj)
{Indicates whether some other object is "equal to" this one.}
|
float |
getCornerRadius()
The radius of the corners in millimeters
|
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.
|
float |
getShadowBlur()
The Gaussian blur size
|
int |
getShadowColor()
The color of the shadow as an RRGGBB color
|
int |
getShadowOpacity()
The opacity of the shadow between 0 and 255
|
float |
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
|
float |
getTrackComponentHorizontalPosition()
Gets the explicitly set horizontal position of the tracking arrow.
|
int |
getTrackComponentSide()
Gets the side that the tracking component should be displayed on if using explicit placement.
|
float |
getTrackComponentVerticalPosition()
Gets the explicitly set vertical position of the tracking arrow.
|
boolean |
isBackgroundPainter()
Returns true if installing this border will override the painting of the component background
|
boolean |
isBezierCorners()
True if the corners are bezier curves, otherwise the corners are drawn as a regular arc
|
boolean |
isBottomLeft()
Returns true if this border corner is round and false if it's square
|
boolean |
isBottomOnlyMode()
Special mode where only the bottom of the round rectangle is rounded and the top is a regular rectangle
|
boolean |
isBottomRight()
Returns true if this border corner is round and false if it's square
|
boolean |
isStrokeMM()
True if the thickness of the stroke is in millimeters
|
boolean |
isTopLeft()
Returns true if this border corner is round and false if it's square
|
boolean |
isTopOnlyMode()
Special mode where only the top of the round rectangle is rounded and the bottom is a regular rectangle
|
boolean |
isTopRight()
Returns true if this border corner is round and false if it's square
|
boolean |
isUseCache()
Checks whether this RoundRectBorder instance caches the border as a background image.
|
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.
|
void |
setArrowSize(float size)
Change the size of the arrow used for component tracking.
|
RoundRectBorder |
shadowBlur(float shadowBlur)
The blur on the shadow this is the standard Gaussian blur radius
|
RoundRectBorder |
shadowColor(int shadowColor)
Sets the color of the shadow as an RRGGBB color
|
RoundRectBorder |
shadowOpacity(int shadowOpacity)
Sets the opacity of the shadow from 0 - 255 where 0 means no shadow and 255 means opaque black shadow
|
RoundRectBorder |
shadowSpread(float shadowSpread)
Sets the spread of the shadow in millimeters i.e how much bigger is it than the actual border
|
RoundRectBorder |
shadowSpread(int shadowSpread)
Sets the spread in pixels of the shadow i.e how much bigger is it than the actual border
|
RoundRectBorder |
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
|
RoundRectBorder |
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
|
RoundRectBorder |
stroke(float stroke,
boolean mm)
Sets the stroke of the border
|
RoundRectBorder |
stroke(Stroke stroke)
Sets the stroke of the border
|
RoundRectBorder |
strokeColor(int strokeColor)
Sets the stroke color of the border
|
RoundRectBorder |
strokeOpacity(int strokeOpacity)
Sets the opacity of the stroke line around the border
|
RoundRectBorder |
topLeftMode(boolean topLeft)
True to draw the top left corner rounded, false to draw it as a corner
|
RoundRectBorder |
topOnlyMode(boolean topOnlyMode)
Special mode where only the top of the round rectangle is rounded and the bottom is a regular rectangle
|
RoundRectBorder |
topRightMode(boolean topRight)
True to draw the top right corner rounded, false to draw it as a corner
|
RoundRectBorder |
trackComponentHorizontalPosition(float pos)
Explicitly sets the horizontal position of the tracking arrow.
|
RoundRectBorder |
trackComponentSide(int side)
Explicitly positions the arrow used for component tracking to a particular
side of the border.
|
RoundRectBorder |
trackComponentVerticalPosition(float pos)
Explicitly sets the vertical position of the tracking arrow.
|
RoundRectBorder |
useCache(boolean useCache)
Sets whether this RoundRectBorder instance should cache the border as a background image.
|
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 RoundRectBorder create()
public RoundRectBorder arrowSize(float size)
size
- Size of arrow in millimeters.public void setArrowSize(float size)
size
- Size of arrow in millimeters.public RoundRectBorder strokeOpacity(int strokeOpacity)
strokeOpacity
- the opacity from 0-255 where 255 is completely opaquepublic RoundRectBorder trackComponentSide(int side)
Border.setTrackComponent(com.codename1.ui.geom.Rectangle)
).
Use in conjunction with trackComponentHorizontalPosition(float)
, and trackComponentHorizontalPosition
.side
- The side to place the tracking arrow on. Values Component.TOP
, Component.BOTTOM
, Component.LEFT
,
or Component.BOTTOM
. Set negative value for default behaviour, which is to just calculate the arrow position
based on the tracking component bounds.public int getTrackComponentSide()
Component.TOP
, Component.BOTTOM
, Component.LEFT
, or a negative number to indicate that the position will be calculated based on the position of the tracking component.
or Component.BOTTOM
.public RoundRectBorder trackComponentVerticalPosition(float pos)
Border.setTrackComponent(com.codename1.ui.geom.Rectangle)
).pos
- Vertical position of the arrow. Values between 0 and 1 will place the arrow in the range from top to bottom. Negative values result in
default behaviour, which is to calculate the position based on the tracking component position.public float getTrackComponentVerticalPosition()
Border.setTrackComponent(com.codename1.ui.geom.Rectangle)
).public RoundRectBorder trackComponentHorizontalPosition(float pos)
Border.setTrackComponent(com.codename1.ui.geom.Rectangle)
).pos
- Vertical position of the arrow. Values between 0 and 1 will place the arrow in the range from left to right. Negative values result in
default behaviour, which is to calculate the position based on the tracking component position.public float getTrackComponentHorizontalPosition()
Border.setTrackComponent(com.codename1.ui.geom.Rectangle)
).public RoundRectBorder useCache(boolean useCache)
This setting is on by default, but can be turned off, as some older, low-memory devices may run into memory trouble if it is using a lot of RoundRectBorders. Turn the cache off for low-memory devices.
NOTE: Using the cache is required for gaussian blur to work. If cache is disabled, then gaussian blur settings will be ignored.
useCache
- True to cache the border as a mutable image on the Component.public boolean isUseCache()
public RoundRectBorder strokeColor(int strokeColor)
strokeColor
- the colorpublic RoundRectBorder stroke(Stroke stroke)
stroke
- the stroke objectpublic RoundRectBorder 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 RoundRectBorder shadowSpread(float shadowSpread)
shadowSpread
- the amount in millimeters representing the size of the shadowpublic RoundRectBorder shadowSpread(int shadowSpread)
shadowSpread
- the amount in pixels representing the size of the shadowpublic RoundRectBorder shadowOpacity(int shadowOpacity)
shadowOpacity
- the opacity of the shadowpublic RoundRectBorder shadowColor(int shadowColor)
shadowColor
- the color of the shadowpublic RoundRectBorder shadowX(float shadowX)
shadowX
- the position of the shadow between 0 - 1 where 0 equals left and 1 equals rightpublic RoundRectBorder shadowY(float shadowY)
shadowY
- the position of the shadow between 0 - 1 where 0 equals top and 1 equals bottompublic RoundRectBorder shadowBlur(float shadowBlur)
shadowBlur
- The blur on the shadow this is the standard Gaussian blur radiuspublic RoundRectBorder cornerRadius(float cornerRadius)
cornerRadius
- the radius valuepublic RoundRectBorder bezierCorners(boolean bezierCorners)
bezierCorners
- true if the corners use a bezier curve for drawingpublic RoundRectBorder topLeftMode(boolean topLeft)
topLeft
- true for round false for sharppublic RoundRectBorder topRightMode(boolean topRight)
topRight
- true for round false for sharppublic RoundRectBorder bottomLeftMode(boolean bottomLeft)
bottomLeft
- true for round false for sharppublic RoundRectBorder bottomRightMode(boolean bottomRight)
bottomRight
- true for round false for sharppublic RoundRectBorder topOnlyMode(boolean topOnlyMode)
topOnlyMode
- new value for top only modepublic RoundRectBorder bottomOnlyMode(boolean bottomOnlyMode)
bottomOnlyMode
- new value for bottom only modepublic 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 getStrokeColor()
public int getStrokeOpacity()
public float getStrokeThickness()
public boolean isStrokeMM()
public boolean isBezierCorners()
public float getShadowSpread()
public int getShadowOpacity()
public int getShadowColor()
public float getShadowX()
public float getShadowY()
public float getShadowBlur()
public float getCornerRadius()
public boolean isTopOnlyMode()
public boolean isBottomOnlyMode()
public boolean equals(Object obj)
Border
public boolean isTopLeft()
public boolean isTopRight()
public boolean isBottomLeft()
public boolean isBottomRight()