Border

The border of a field is the visual area that surrounds the content and padding of the field. A border is typically represented by the Border class, which is included in the net.rim.device.api.ui.decor package.

The Border class is an abstract class. To create Border objects, you can use methods that are provided in the BorderFactory class, including the following:

  • createSimpleBorder(XYEdges): Creates a solid, single-line border with sharp corners
  • createRoundedBorder(XYEdges): Creates a solid, single-line border with rounded corners
  • createBevelBorder(XYEdges): Creates a 3-D bevel border

The BorderFactory class contains different versions of these methods that you can use to create borders with specific sizes, styles, and colors. You can also extend the Border class to create a custom border. If you choose to create a custom border, you must implement paint(Graphics, XYRect) to specify how the border is drawn on the screen, and isTransparent() to specify whether the border is transparent.

You can invoke Field.getBorder() to retrieve a Border object that represents the border of a field, based on the current visual state of the field. You can also invoke Field.getBorder(int) to retrieve a border that is associated with a particular visual state. You can specify a visual state by using constants in Field, such as Field.VISUAL_STATE_ACTIVE, Field.VISUAL_STATE_FOCUS, Field.VISUAL_STATE_DISABLED, and so on. You can invoke Field.setBorder(Border) and its variations to set the border for a field.

Next topic: Margin
Previous topic: Padding

Was this information helpful? Send us your comments.