public class Border

  1. Object
  2. Border

Known subtypesCSSBorder, RoundBorder, RoundRectBorder

Base class that allows us to render a border for a component, a border is drawn before the component and is drawn within the padding region of the component. It is the responsibility of the component not to draw outside of the border line.

This class can be extended to provide additional border types and custom made border types.

A border can optionally paint the background of the component, this depends on the border type and is generally required for rounded borders that “know” the area that should be filled.

Constructors

protected Border()Prevents usage of new operator, use the factory methods in the class or subclass to create new border types.

Methods

public static Border getEmpty()Deprecated Returns an empty border, this is mostly useful for overriding components that have a border by default
public static Border createEmpty()Creates an empty border, this is useful where we don’t want a border for a component but want a focus border etc…
public static Border createImageBorder(Image top, Image bottom, Image left, Image right, Image topLeft, Image topRight, Image bottomLeft, Image bottomRight, Image background)The given top/bottom/left/right images are tiled appropriately across the matching sides of the border and the corners are placed as expected in the four corners.
public static Border createImageSplicedBorder(Image img, double topInset, double rightInset, double bottomInset, double leftInset)The given image is spliced into 9 pieces based on the provided top, right, bottom, and left insets, and the resulting sub-images are used to form a 9-piece image border via com.codename1.ui.Image, com.codename1.ui.Image, com.codename1.ui.I...
public static Border createImageScaledBorder(Image top, Image bottom, Image left, Image right, Image topLeft, Image topRight, Image bottomLeft, Image bottomRight, Image background)The given top/bottom/left/right images are scaled appropriately across the matching sides of the border and the corners are placed as expected in the four corners.
public static Border createHorizonalImageBorder(Image left, Image right, Image center)This is an image border that can only grow horizontally
public static Border createVerticalImageBorder(Image top, Image bottom, Image center)This is an image border that can only grow vertically
public static Border createImageBorder(Image top, Image topLeft, Image background)The given images are tiled appropriately across the matching side of the border, rotated and placed as expected in the four corners.
public static Border createLineBorder(int thickness)Creates a line border that uses the color of the component foreground for drawing
public static Border createLineBorder(float thickness)Creates a line border that uses the color of the component foreground for drawing
public static Border createUndelineBorder(int thickness)Deprecated Creates an underline border that uses the color of the component foreground for drawing
public static Border createUnderlineBorder(int thickness)Creates an underline border that uses the color of the component foreground for drawing
public static Border createUndelineBorder(float thickness)Deprecated Creates an underline border that uses the color of the component foreground for drawing
public static Border createUnderlineBorder(float thickness)Creates an underline border that uses the color of the component foreground for drawing
public static Border createUnderlineBorder(int thickness, int color)Creates an underline border that uses the given color
public static Border createUnderlineBorder(float thickness, int color)Creates an underline border that uses the given color
public static Border createDottedBorder(int thickness, int color)Creates a dotted border with the specified thickness and color
public static Border createDashedBorder(int thickness, int color)Creates a dashed border with the specified thickness and color
public static Border createDoubleBorder(int thickness, int color)Creates a double border with the specified thickness and color
public static Border createDottedBorder(int thickness)Creates a dotted border with the specified thickness and the theme colors
public static Border createDashedBorder(int thickness)Creates a dashed border with the specified thickness and the theme colors
public static Border createDoubleBorder(int thickness)Creates a double border with the specified thickness and color
public static Border createOutsetBorder(int thickness)Creates an outset border with the specified thickness and theme colors
public static Border createOutsetBorder(int thickness, int color)Creates an outset border with the specified thickness and color
public static Border createInsetBorder(int thickness)Creates an inset border with the specified thickness and theme colors
public static Border createInsetBorder(int thickness, int color)Creates an inset border with the specified thickness and color
public static Border createGrooveBorder(int thickness)Creates a groove border with the specified thickness and theme colors
public static Border createGrooveBorder(int thickness, int color)Creates a groove border with the specified thickness and color
public static Border createRidgeBorder(int thickness)Creates a ridge border with the specified thickness and theme colors
public static Border createRidgeBorder(int thickness, int color)Creates a ridge border with the specified thickness and color
public static Border createLineBorder(int thickness, String title)Creates a line border with the specified title
public static Border createLineBorder(int thickness, int color, String title)Creates a line border that uses the given color for the component
public static Border createLineBorder(int thickness, int color)Creates a line border that uses the given color for the component
public static Border createLineBorder(float thickness, int color)Creates a line border that uses the given color for the component
public static Border createRoundBorder(int arcWidth, int arcHeight)Deprecated Creates a rounded corner border that uses the color of the component foreground for drawing.
public static Border createRoundBorder(int arcWidth, int arcHeight, boolean outline)Deprecated Creates a rounded corner border that uses the color of the component foreground for drawing.
public static Border createRoundBorder(int arcWidth, int arcHeight, int color)Deprecated Creates a rounded border that uses the given color for the component.
public static Border createRoundBorder(int arcWidth, int arcHeight, int color, boolean outline)Deprecated Creates a rounded border that uses the given color for the component.
public static Border createEtchedLowered()Creates a lowered etched border with default colors, highlight is derived from the component and shadow is a plain dark color
public static Border createEtchedLowered(int highlight, int shadow)Creates a raised etched border with the given colors
public static Border createEtchedRaised()Creates a lowered etched border with default colors, highlight is derived from the component and shadow is a plain dark color
public static Border createEtchedRaised(int highlight, int shadow)Creates a raised etched border with the given colors
public static Border createCompoundBorder(Border top, Border bottom, Border left, Border right)Creates a border that is comprised of multiple border types so one border type can be used on top while another one can be used at the bottom.
public static Border createBevelLowered()Creates a lowered bevel border with default colors, highlight is derived from the component and shadow is a plain dark color
public static Border createBevelLowered(int highlightOuter, int highlightInner, int shadowOuter, int shadowInner)Creates a raised bevel border with the given colors
public static Border createBevelRaised()Creates a lowered bevel border with default colors, highlight is derived from the component and shadow is a plain dark color
public static Border createBevelRaised(int highlightOuter, int highlightInner, int shadowOuter, int shadowInner)Creates a raised bevel border with the given colors
public static Border getDefaultBorder()Gets the default border to the given value
public static void setDefaultBorder(Border border)Sets the default border to the given value
public Border mirrorBorder()If a border is a horizontal image border it can be mirrored which is useful for an RTL scenario
public void setImageBorderSpecialTile(Image tileTop, Image tileBottom, Image tileLeft, Image tileRight, Component trackComponent)This method is designed mainly for the purpose of creating an arrow that will track a specific component using the image border the tile given would be an arrow like image just like the ones used for the top/bottom/left/right images.
protected Rectangle getTrackComponent()The track component is an area to which an arrow based border should point at.
public void setTrackComponent(Component trackComponent)In the case of an arrow border the track component lets us track the position to which the border is pointing
public void setTrackComponent(Rectangle trackComponent)In the case of an arrow border the track component lets us track the position to which the border is pointing
public void setImageBorderSpecialTile(Image tileTop, Image tileBottom, Image tileLeft, Image tileRight, Rectangle trackComponent)This method is designed mainly for the purpose of creating an arrow that will track a specific component using the image border the tile given would be an arrow like image just like the ones used for the top/bottom/left/right images.
public void clearImageBorderSpecialTile()Cleans the tile tracking state allowing the garbage collector to pick up the component and the image data
public void addOuterBorder(Border outer)Ads a border that wraps this border
public 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. for the case of an image border the minimum height would be top + bottom and the m…
public 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. for the case of an image border the minimum height would be top + bottom and the m…
public boolean isEmptyBorder()Indicates whether this is an empty border
public boolean equals(Object obj){Indicates whether some other object is “equal to” this one.
public int hashCode()Returns a hash code value for the object.
public boolean isBackgroundPainter()Returns true if installing this border will override the painting of the component background
public boolean isRectangleType()Returns true if this border type is a rectangle border.
public Border getFocusedInstance()Deprecated Returns the focused version of the border if one is installed
public void setFocusedInstance(Border focused)Deprecated Allows us to define a border that will act as the focused version of this border
public Border getPressedInstance()Returns the pressed version of the border if one is set by the user
public void setPressedInstance(Border pressed)Allows us to define a border that will act as the pressed version of this border
public Border createPressedVersion()When applied to buttons borders produce a version that reverses the effects of the border providing a pressed feel
public 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.
public void paint(Graphics g, Component c)Draws the border for the given component, this method is called before a call to background painting is made.
public int getThickness()This method returns how thick is the border in pixels, notice this doesn’t apply to most border types
public void setThickness(int thickness)This method returns sets the border thickness in pixels, notice this doesn’t apply to most border types
public boolean isPaintOuterBorderFirst()Allows toggling the order in which the outer and inner borders are painted for the Outer border type
public void setPaintOuterBorderFirst(boolean paintOuterBorderFirst)Allows toggling the order in which the outer and inner borders are painted for the Outer border type
public Border[] getCompoundBorders()This method returns the Compound Borders array.
public void lock()This callback indicates that a component pointing at this border is initialized, this method is useful for image borders whose lock methods are implicitly invoked.
public void unlock()This callback indicates that a component pointing at this border is now deinitilized This method may be invoked multiple times.
public Object getProperty(String n)This method is for internal usage only!

Inherited methods

Constructor details

Border

protected Border()
Prevents usage of new operator, use the factory methods in the class or subclass to create new border types.

Method details

getEmpty

public static Border getEmpty()
Deprecated. use createEmpty instead
Returns an empty border, this is mostly useful for overriding components that have a border by default

Returns

a border than draws nothing

createEmpty

public static Border createEmpty()
Creates an empty border, this is useful where we don’t want a border for a component but want a focus border etc…

Returns

a border than draws nothing

createImageBorder

public static Border createImageBorder(Image top, Image bottom, Image left, Image right, Image topLeft, Image topRight, Image bottomLeft, Image bottomRight, Image background)

The given top/bottom/left/right images are tiled appropriately across the matching sides of the border and the corners are placed as expected in the four corners. The background image is optional and it will be tiled in the background if necessary.

By default this border does not override background unless a background image is specified

Parameters

top Image
the image of the top line
bottom Image
the image of the bottom line
left Image
the image of the left line
right Image
the image of the right line
topLeft Image
the image of the top left corner
topRight Image
the image of the top right corner
bottomLeft Image
the image of the bottom left corner
bottomRight Image
the image of the bottom right corner
background Image
the image of the background (optional)

Returns

new border instance

createImageSplicedBorder

public static Border createImageSplicedBorder(Image img, double topInset, double rightInset, double bottomInset, double leftInset)

The given image is spliced into 9 pieces based on the provided top, right, bottom, and left insets, and the resulting sub-images are used to form a 9-piece image border via com.codename1.ui.Image, com.codename1.ui.Image, com.codename1.ui.Image, com.codename1.ui.Image, com.codename1.ui.Image, com.codename1.ui.Image, com.codename1.ui.Image, com.codename1.ui.Image)

Insets are all given in a (u,v) coordinate space where (0,0) is the top-left corner of the image, and (1.0, 1.0) is the bottom-right corner of the image.

Parameters

img Image
The image to be used as a background image and spliced.
topInset double
Not documented.
rightInset double
Not documented.
bottomInset double
Not documented.
leftInset double
Not documented.

Returns

A 9-piece image border.

createImageScaledBorder

public static Border createImageScaledBorder(Image top, Image bottom, Image left, Image right, Image topLeft, Image topRight, Image bottomLeft, Image bottomRight, Image background)

The given top/bottom/left/right images are scaled appropriately across the matching sides of the border and the corners are placed as expected in the four corners. The background image is optional and it will be tiled in the background if necessary.

By default this border does not override background unless a background image is specified

Parameters

top Image
the image of the top line
bottom Image
the image of the bottom line
left Image
the image of the left line
right Image
the image of the right line
topLeft Image
the image of the top left corner
topRight Image
the image of the top right corner
bottomLeft Image
the image of the bottom left corner
bottomRight Image
the image of the bottom right corner
background Image
the image of the background (optional)

Returns

new border instance

createHorizonalImageBorder

public static Border createHorizonalImageBorder(Image left, Image right, Image center)
This is an image border that can only grow horizontally

Parameters

left Image
the image of the left side
right Image
the image of the right side
center Image
the image of the center

Returns

new border instance

createVerticalImageBorder

public static Border createVerticalImageBorder(Image top, Image bottom, Image center)
This is an image border that can only grow vertically

Parameters

top Image
the image of the top
bottom Image
the image of the bottom
center Image
the image of the center

Returns

new border instance

createImageBorder

public static Border createImageBorder(Image top, Image topLeft, Image background)

The given images are tiled appropriately across the matching side of the border, rotated and placed as expected in the four corners. The background image is optional and it will be tiled in the background if necessary.

By default this border does not override background unless a background image is specified.

Notice that this version of the method is potentially much more efficient since images are rotated internally and this might save quite a bit of memory!

The top and topLeft images must be square! The width and height of these images must be equal otherwise rotation won’t work as you expect.

Parameters

top Image
the image of the top line
topLeft Image
the image of the top left corner
background Image
the image of the background (optional)

Returns

new border instance

createLineBorder

public static Border createLineBorder(int thickness)
Creates a line border that uses the color of the component foreground for drawing

Parameters

thickness int
thickness of the border in pixels

Returns

new border instance

createLineBorder

public static Border createLineBorder(float thickness)
Creates a line border that uses the color of the component foreground for drawing

Parameters

thickness float
thickness of the border in millimeters

Returns

new border instance

createUndelineBorder

public static Border createUndelineBorder(int thickness)
Deprecated. due to a spelling mistake. Use thickness)
Creates an underline border that uses the color of the component foreground for drawing

Parameters

thickness int
thickness of the border in pixels

Returns

new border instance

createUnderlineBorder

public static Border createUnderlineBorder(int thickness)
Creates an underline border that uses the color of the component foreground for drawing

Parameters

thickness int
thickness of the border in pixels

Returns

new border instance

createUndelineBorder

public static Border createUndelineBorder(float thickness)
Deprecated. due to a spelling mistake. Use thickness)
Creates an underline border that uses the color of the component foreground for drawing

Parameters

thickness float
thickness of the border in millimeters

Returns

new border instance

createUnderlineBorder

public static Border createUnderlineBorder(float thickness)
Creates an underline border that uses the color of the component foreground for drawing

Parameters

thickness float
thickness of the border in millimeters

Returns

new border instance

createUnderlineBorder

public static Border createUnderlineBorder(int thickness, int color)
Creates an underline border that uses the given color

Parameters

thickness int
thickness of the border in pixels
color int
the color

Returns

new border instance

createUnderlineBorder

public static Border createUnderlineBorder(float thickness, int color)
Creates an underline border that uses the given color

Parameters

thickness float
thickness of the border in millimeters
color int
the color

Returns

new border instance

createDottedBorder

public static Border createDottedBorder(int thickness, int color)
Creates a dotted border with the specified thickness and color

Parameters

thickness int
The border thickness in pixels
color int
The border color

Returns

The border

createDashedBorder

public static Border createDashedBorder(int thickness, int color)
Creates a dashed border with the specified thickness and color

Parameters

thickness int
The border thickness in pixels
color int
The border color

Returns

The border

createDoubleBorder

public static Border createDoubleBorder(int thickness, int color)
Creates a double border with the specified thickness and color

Parameters

thickness int
The border thickness in pixels
color int
The border color

Returns

The border

createDottedBorder

public static Border createDottedBorder(int thickness)
Creates a dotted border with the specified thickness and the theme colors

Parameters

thickness int
The border thickness in pixels

Returns

The border

createDashedBorder

public static Border createDashedBorder(int thickness)
Creates a dashed border with the specified thickness and the theme colors

Parameters

thickness int
The border thickness in pixels

Returns

The border

createDoubleBorder

public static Border createDoubleBorder(int thickness)
Creates a double border with the specified thickness and color

Parameters

thickness int
The border thickness in pixels

Returns

The border

createOutsetBorder

public static Border createOutsetBorder(int thickness)
Creates an outset border with the specified thickness and theme colors

Parameters

thickness int
The border thickness in pixels

Returns

The border

createOutsetBorder

public static Border createOutsetBorder(int thickness, int color)
Creates an outset border with the specified thickness and color

Parameters

thickness int
The border thickness in pixels
color int
The border color

Returns

The border

createInsetBorder

public static Border createInsetBorder(int thickness)
Creates an inset border with the specified thickness and theme colors

Parameters

thickness int
The border thickness in pixels

Returns

The border

createInsetBorder

public static Border createInsetBorder(int thickness, int color)
Creates an inset border with the specified thickness and color

Parameters

thickness int
The border thickness in pixels
color int
The border color

Returns

The border

createGrooveBorder

public static Border createGrooveBorder(int thickness)
Creates a groove border with the specified thickness and theme colors

Parameters

thickness int
The border thickness in pixels

Returns

The border

createGrooveBorder

public static Border createGrooveBorder(int thickness, int color)
Creates a groove border with the specified thickness and color

Parameters

thickness int
The border thickness in pixels
color int
The border color

Returns

The border

createRidgeBorder

public static Border createRidgeBorder(int thickness)
Creates a ridge border with the specified thickness and theme colors

Parameters

thickness int
The border thickness in pixels

Returns

The border

createRidgeBorder

public static Border createRidgeBorder(int thickness, int color)
Creates a ridge border with the specified thickness and color

Parameters

thickness int
The border thickness in pixels
color int
The border color

Returns

The border

createLineBorder

public static Border createLineBorder(int thickness, String title)
Creates a line border with the specified title

Parameters

thickness int
thickness of the border in pixels
title String
The borders title

Returns

new border instance

createLineBorder

public static Border createLineBorder(int thickness, int color, String title)
Creates a line border that uses the given color for the component

Parameters

thickness int
thickness of the border in pixels
color int
the color for the border
title String
The borders title

Returns

new border instance

createLineBorder

public static Border createLineBorder(int thickness, int color)
Creates a line border that uses the given color for the component

Parameters

thickness int
thickness of the border in pixels
color int
the color for the border

Returns

new border instance

createLineBorder

public static Border createLineBorder(float thickness, int color)
Creates a line border that uses the given color for the component

Parameters

thickness float
thickness of the border in millimeters
color int
the color for the border

Returns

new border instance

createRoundBorder

public static Border createRoundBorder(int arcWidth, int arcHeight)
Deprecated. the performance of round rect borders is REALLY slow, we recommend people use image borders which are faster, more portable and better looking

Creates a rounded corner border that uses the color of the component foreground for drawing. Due to technical issues (lack of shaped clipping) performance and memory overhead of round borders can be low if used with either a bgImage or translucency!

This border overrides any painter used on the component and would ignor such a painter.

Parameters

arcWidth int
the horizontal diameter of the arc at the four corners.
arcHeight int
the vertical diameter of the arc at the four corners.

Returns

new border instance

createRoundBorder

public static Border createRoundBorder(int arcWidth, int arcHeight, boolean outline)
Deprecated. the performance of round rect borders is REALLY slow, we recommend people use image borders which are faster, more portable and better looking

Creates a rounded corner border that uses the color of the component foreground for drawing. Due to technical issues (lack of shaped clipping) performance and memory overhead of round borders can be low if used with either a bgImage or translucency!

This border overrides any painter used on the component and would ignor such a painter.

Parameters

arcWidth int
the horizontal diameter of the arc at the four corners.
arcHeight int
the vertical diameter of the arc at the four corners.
outline boolean
whether the round rect border outline should be drawn

Returns

new border instance

createRoundBorder

public static Border createRoundBorder(int arcWidth, int arcHeight, int color)
Deprecated. the performance of round rect borders is REALLY slow, we recommend people use image borders which are faster, more portable and better looking

Creates a rounded border that uses the given color for the component. Due to technical issues (lack of shaped clipping) performance and memory overhead of round borders can be low if used with either a bgImage or translucency!

This border overrides any painter used on the component and would ignor such a painter.

Parameters

arcWidth int
the horizontal diameter of the arc at the four corners.
arcHeight int
the vertical diameter of the arc at the four corners.
color int
the color for the border

Returns

new border instance

createRoundBorder

public static Border createRoundBorder(int arcWidth, int arcHeight, int color, boolean outline)
Deprecated. the performance of round rect borders is REALLY slow, we recommend people use image borders which are faster, more portable and better looking

Creates a rounded border that uses the given color for the component. Due to technical issues (lack of shaped clipping) performance and memory overhead of round borders can be low if used with either a bgImage or translucency!

This border overrides any painter used on the component and would ignor such a painter.

Parameters

arcWidth int
the horizontal diameter of the arc at the four corners.
arcHeight int
the vertical diameter of the arc at the four corners.
color int
the color for the border
outline boolean
whether the round rect border outline should be drawn

Returns

new border instance

createEtchedLowered

public static Border createEtchedLowered()
Creates a lowered etched border with default colors, highlight is derived from the component and shadow is a plain dark color

Returns

new border instance

createEtchedLowered

public static Border createEtchedLowered(int highlight, int shadow)
Creates a raised etched border with the given colors

Parameters

highlight int
color RGB value
shadow int
color RGB value

Returns

new border instance

createEtchedRaised

public static Border createEtchedRaised()
Creates a lowered etched border with default colors, highlight is derived from the component and shadow is a plain dark color

Returns

new border instance

createEtchedRaised

public static Border createEtchedRaised(int highlight, int shadow)
Creates a raised etched border with the given colors

Parameters

highlight int
color RGB value
shadow int
color RGB value

Returns

new border instance

createCompoundBorder

public static Border createCompoundBorder(Border top, Border bottom, Border left, Border right)
Creates a border that is comprised of multiple border types so one border type can be used on top while another one can be used at the bottom. Notice that this doesn’t work well with all border types (e.g. image borders)

Parameters

top Border
the top border
bottom Border
the bottom border
left Border
the left border
right Border
the right border

Returns

a compound border

createBevelLowered

public static Border createBevelLowered()
Creates a lowered bevel border with default colors, highlight is derived from the component and shadow is a plain dark color

Returns

new border instance

createBevelLowered

public static Border createBevelLowered(int highlightOuter, int highlightInner, int shadowOuter, int shadowInner)
Creates a raised bevel border with the given colors

Parameters

highlightOuter int
RGB of the outer edge of the highlight area
highlightInner int
RGB of the inner edge of the highlight area
shadowOuter int
RGB of the outer edge of the shadow area
shadowInner int
RGB of the inner edge of the shadow area

Returns

new border instance

createBevelRaised

public static Border createBevelRaised()
Creates a lowered bevel border with default colors, highlight is derived from the component and shadow is a plain dark color

Returns

new border instance

createBevelRaised

public static Border createBevelRaised(int highlightOuter, int highlightInner, int shadowOuter, int shadowInner)
Creates a raised bevel border with the given colors

Parameters

highlightOuter int
RGB of the outer edge of the highlight area
highlightInner int
RGB of the inner edge of the highlight area
shadowOuter int
RGB of the outer edge of the shadow area
shadowInner int
RGB of the inner edge of the shadow area

Returns

new border instance

getDefaultBorder

public static Border getDefaultBorder()
Gets the default border to the given value

Returns

the default border

setDefaultBorder

public static void setDefaultBorder(Border border)
Sets the default border to the given value

Parameters

border Border
new border value

mirrorBorder

public Border mirrorBorder()
If a border is a horizontal image border it can be mirrored which is useful for an RTL scenario

Returns

the current border or a mirrored instance

setImageBorderSpecialTile

public void setImageBorderSpecialTile(Image tileTop, Image tileBottom, Image tileLeft, Image tileRight, Component trackComponent)
This method is designed mainly for the purpose of creating an arrow that will track a specific component using the image border the tile given would be an arrow like image just like the ones used for the top/bottom/left/right images. This image would be positioned so it points at the center of the track component

Parameters

tileTop Image
an image that will replace one of the tiles on the top if the track component is there
tileBottom Image
an image that will replace one of the tiles on the bottom if the track component is there
tileLeft Image
an image that will replace one of the tiles on the left if the track component is there
tileRight Image
an image that will replace one of the tiles on the right if the track component is there
trackComponent Component
the component that will be tracked for the positioning of the tile

getTrackComponent

protected Rectangle getTrackComponent()
The track component is an area to which an arrow based border should point at. It’s assumed to be outside of the border region in absolute screen coordinates.

Returns

the rectangle to point at or null if this isn’t an arrow border

setTrackComponent

public void setTrackComponent(Component trackComponent)
In the case of an arrow border the track component lets us track the position to which the border is pointing

Parameters

trackComponent Component
the track component

setTrackComponent

public void setTrackComponent(Rectangle trackComponent)
In the case of an arrow border the track component lets us track the position to which the border is pointing

Parameters

trackComponent Rectangle
the track component

setImageBorderSpecialTile

public void setImageBorderSpecialTile(Image tileTop, Image tileBottom, Image tileLeft, Image tileRight, Rectangle trackComponent)
This method is designed mainly for the purpose of creating an arrow that will track a specific component using the image border the tile given would be an arrow like image just like the ones used for the top/bottom/left/right images. This image would be positioned so it points at the center of the track component

Parameters

tileTop Image
an image that will replace one of the tiles on the top if the track component is there
tileBottom Image
an image that will replace one of the tiles on the bottom if the track component is there
tileLeft Image
an image that will replace one of the tiles on the left if the track component is there
tileRight Image
an image that will replace one of the tiles on the right if the track component is there
trackComponent Rectangle
the component that will be tracked for the positioning of the tile

clearImageBorderSpecialTile

public void clearImageBorderSpecialTile()
Cleans the tile tracking state allowing the garbage collector to pick up the component and the image data

addOuterBorder

public void addOuterBorder(Border outer)
Ads a border that wraps this border

Parameters

outer Border
The outer border

getMinimumHeight

public 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. for the case of an image border the minimum height would be top + bottom and the minimum width would be left+right

Returns

0 if not applicable or a dimension if it is.

getMinimumWidth

public 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. for the case of an image border the minimum height would be top + bottom and the minimum width would be left+right

Returns

0 if not applicable or a dimension if it is.

isEmptyBorder

public boolean isEmptyBorder()
Indicates whether this is an empty border

Returns

true if this is an empty border

equals

public boolean equals(Object obj)
{Indicates whether some other object is “equal to” this one. The equals method implements an equivalence relation: It is reflexive: for any reference value x, x.equals(x) should return true. It is symmetric: for any reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true. It is transitive: for any reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true. It is consistent: for any reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the object is modified. For any non-null reference value x, x.equals(null) should return false. The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values x and y, this method returns true if and only if x and y refer to the same object (x==y has the value true).}

hashCode

public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable. The general contract of hashCode is: Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application. If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result. It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hashtables. As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

isBackgroundPainter

public boolean isBackgroundPainter()
Returns true if installing this border will override the painting of the component background

Returns

true if this border replaces the painter

isRectangleType

public boolean isRectangleType()
Returns true if this border type is a rectangle border.

Returns

true if this border is rectangle

getFocusedInstance

public Border getFocusedInstance()
Deprecated. use the getSelectedStyle() method in the component class
Returns the focused version of the border if one is installed

Returns

a focused version of this border if one exists

setFocusedInstance

public void setFocusedInstance(Border focused)
Deprecated. use the getSelectedStyle() method in the component class
Allows us to define a border that will act as the focused version of this border

Parameters

focused Border
a border that will be returned by the focused version method

getPressedInstance

public Border getPressedInstance()
Returns the pressed version of the border if one is set by the user

Returns

the pressed instance of this border

setPressedInstance

public void setPressedInstance(Border pressed)
Allows us to define a border that will act as the pressed version of this border

Parameters

pressed Border
a border that will be returned by the pressed version method

createPressedVersion

public Border createPressedVersion()
When applied to buttons borders produce a version that reverses the effects of the border providing a pressed feel

Returns

a border that will make the button feel pressed

paintBorderBackground

public 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.

Parameters

g Graphics
graphics context to draw onto
c Component
component whose border should be drawn

paint

public void paint(Graphics g, Component c)
Draws the border for the given component, this method is called before a call to background painting is made.

Parameters

g Graphics
graphics context to draw onto
c Component
component whose border should be drawn

getThickness

public int getThickness()
This method returns how thick is the border in pixels, notice this doesn’t apply to most border types

Returns

the Border thickness

setThickness

public void setThickness(int thickness)
This method returns sets the border thickness in pixels, notice this doesn’t apply to most border types

Parameters

thickness int
the Border thickness

isPaintOuterBorderFirst

public boolean isPaintOuterBorderFirst()
Allows toggling the order in which the outer and inner borders are painted for the Outer border type

Returns

whether the outside border should be painter first

setPaintOuterBorderFirst

public void setPaintOuterBorderFirst(boolean paintOuterBorderFirst)
Allows toggling the order in which the outer and inner borders are painted for the Outer border type

Parameters

paintOuterBorderFirst boolean
whether the outside border should be painter first

getCompoundBorders

public Border[] getCompoundBorders()
This method returns the Compound Borders array. The array size is 4 and the borders arranged as follows : Border[] borders = getCompoundBorders(); Border top = borders[Component.TOP]; Border bottom = borders[Component.BOTTOM]; Border left = borders[Component.LEFT]; Border right = borders[Component.RIGHT];

Returns

the borders array or null if this is not a Compound Border

lock

public void lock()
This callback indicates that a component pointing at this border is initialized, this method is useful for image borders whose lock methods are implicitly invoked. This method may be invoked multiple times.

unlock

public void unlock()
This callback indicates that a component pointing at this border is now deinitilized This method may be invoked multiple times.

getProperty

public Object getProperty(String n)
This method is for internal usage only!