net.rim.device.api.ui.decor
Class Border

java.lang.Object
  |
  +--net.rim.device.api.ui.decor.Border

public abstract class Border
extends Object

A border with four edges (top, right, bottom, left) around an unfocusable rectangular region contained within a screen or a field. It cannot be instantiated directly. Different types of borders can be created by calling one of the following methods in the BorderFactory:

Alternatively, create your own custom border by extending Border.

Each border must (at least) implement #draw(Graphics, XYRect) and isTransparent(). The paint(Graphics, XYRect) method is called by the paint framework in Field and Screen. A border can be set via Field.setBorder(Border).

Since:
JDE 4.6.0

Field Summary
static int STYLE_DASHED
          Defines a dashed (---) style applicable to simple and rounded borders.
static int STYLE_DOTTED
          Defines a dotted (...) style applicable to simple and rounded borders.
static int STYLE_FILLED
          Defines a filled style applicable to rounded borders.
static int STYLE_SOLID
          Defines a solid (___) style applicable to simple and rounded borders.
static int STYLE_TRANSPARENT
          Defines a transparent style applicable to simple and rounded borders.
 
Constructor Summary
protected Border(XYEdges edges, int style)
          Do not allow direct instantiation.
 
Method Summary
 Background getBackground()
          Retrieves the border's background if it exists.
 int getBottom()
          Retrieves the width/thickness of the border's bottom edge.
 XYEdges getEdges()
          Retrieve the XYEdges object representing the width/thickness of the border's four sides in pixels.
 void getEdges(XYEdges edges)
          Copies the width/thickness of the border's four sides in pixels into the specified XYEdges object.
 int getLeft()
          Retrieves the width/thickness of the border's left edge.
 int getRight()
          Retrieves the width/thickness of the border's right edge.
 int getStyle()
          Retrieves the style of the border.
 int getTop()
          Retrieves the width/thickness of the border's top edge.
 boolean isTransparent()
          Specifies whether the border is transparent based on set style.
abstract  void paint(Graphics graphics, XYRect rect)
          Invoked by paint methods in Field and Screen.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STYLE_DASHED

public static final int STYLE_DASHED
Defines a dashed (---) style applicable to simple and rounded borders.
Since:
JDE 4.6.0

STYLE_DOTTED

public static final int STYLE_DOTTED
Defines a dotted (...) style applicable to simple and rounded borders.
Since:
JDE 4.6.0

STYLE_FILLED

public static final int STYLE_FILLED
Defines a filled style applicable to rounded borders.
Since:
JDE 4.6.0

STYLE_SOLID

public static final int STYLE_SOLID
Defines a solid (___) style applicable to simple and rounded borders.
Since:
JDE 4.6.0

STYLE_TRANSPARENT

public static final int STYLE_TRANSPARENT
Defines a transparent style applicable to simple and rounded borders.
Since:
JDE 4.6.0
Constructor Detail

Border

protected Border(XYEdges edges,
                 int style)
Do not allow direct instantiation.
Parameters:
edges - XYEdges object representing the width/thickness of the border's four sides in pixels.
style - STYLE_TRANSPARENT, STYLE_SOLID, SYLE_DOTTED, STYLE_DASHED.
Throws:
IllegalArgumentException - If edges is null.
Since:
JDE 4.6.0
Method Detail

getBackground

public Background getBackground()
Retrieves the border's background if it exists. Override in appropriate subclasses.
Returns:
Background object defined by the border.
Since:
JDE 4.6.0

getBottom

public final int getBottom()
Retrieves the width/thickness of the border's bottom edge.
Returns:
Space at bottom edge in pixels.
Since:
JDE 4.6.0

getEdges

public final XYEdges getEdges()
Retrieve the XYEdges object representing the width/thickness of the border's four sides in pixels.
Returns:
XYEdges instance of the border.
Since:
JDE 4.6.0

getEdges

public final void getEdges(XYEdges edges)
Copies the width/thickness of the border's four sides in pixels into the specified XYEdges object.
Parameters:
edges - XYEdges object in which to copy border widths/thickness.
Since:
JDE 4.6.0

getLeft

public final int getLeft()
Retrieves the width/thickness of the border's left edge.
Returns:
Space at left edge in pixels.
Since:
JDE 4.6.0

getRight

public final int getRight()
Retrieves the width/thickness of the border's right edge.
Returns:
Space at right edge in pixels.
Since:
JDE 4.6.0

getStyle

public final int getStyle()
Retrieves the style of the border.
Returns:
STYLE_TRANSPARENT, STYLE_SOLID, SYLE_DOTTED, STYLE_DASHED.
Since:
JDE 4.6.0

getTop

public final int getTop()
Retrieves the width/thickness of the border's top edge.
Returns:
Space at top edge in pixels.
Since:
JDE 4.6.0

isTransparent

public final boolean isTransparent()
Specifies whether the border is transparent based on set style.
Returns:
True if border is transparent. False if border is opaque.
Since:
JDE 4.6.0

paint

public abstract void paint(Graphics graphics,
                           XYRect rect)
Invoked by paint methods in Field and Screen. This is an abstract method; any class that extends Border must implement this method appropriate to its needs.
Parameters:
graphics - Graphics context on which to draw.
rect - Bounding rectangle within graphics context.
Since:
JDE 4.6.0



Copyright 1999-2008 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.