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

java.lang.Object
  extended by net.rim.device.api.ui.decor.Background

public abstract class Background
extends Object

A background represents an unfocusable rectangular region contained within a screen or a field. It cannot be instantiated directly. Different types of backgrounds can be created by calling the following methods in the BackgroundFactory:

Alternatively, create your own custom background by extending Background. Each background must (at least) implement Background.draw(Graphics, XYRect) and Background.isTransparent().

The background of a field or screen can be set by invoking Field.setBackground(Background).

Since:
BlackBerry API 4.6.0

Field Summary
static int POSITION_X_CENTER
          Center horizontal positioning for bitmap backgrounds.
static int POSITION_X_INHERIT
          Inherit horizontal positioning for bitmap backgrounds.
static int POSITION_X_LEFT
          Left horizontal positioning for bitmap backgrounds.
static int POSITION_X_RIGHT
          Right horizontal positioning for bitmap backgrounds.
static int POSITION_Y_BOTTOM
          Bottom vertical positioning for bitmap backgrounds.
static int POSITION_Y_CENTER
          Center vertical positioning for bitmap backgrounds.
static int POSITION_Y_INHERIT
          Inherit vertical positioning for bitmap backgrounds.
static int POSITION_Y_TOP
          Top vertical positioning for bitmap backgrounds.
static int REPEAT_BOTH
          Both horizontal and vertical bitmap tiling for bitmap backgrounds.
static int REPEAT_HORIZONTAL
          Horizontal bitmap tiling for bitmap backgrounds.
static int REPEAT_INHERIT
          Inherit bitmap tiling properties for bitmap backgrounds.
static int REPEAT_NONE
          Suppress bitmap tiling for bitmap backgrounds.
static int REPEAT_SCALE_TO_FIT
          Scale to fit bitmap for bitmap backgrounds.
static int REPEAT_VERTICAL
          Vertical bitmap tiling for bitmap backgrounds.
 
Constructor Summary
protected Background()
          Do not allow direct instantiation.
 
Method Summary
abstract  void draw(Graphics graphics, XYRect rect)
          Invoked by paint methods in Field and Screen.
abstract  boolean isTransparent()
          Specifies whether the background is transparent.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

POSITION_X_INHERIT

public static final int POSITION_X_INHERIT
Inherit horizontal positioning for bitmap backgrounds.

See Also:
Constant Field Values
Since:
BlackBerry API 4.6.0

POSITION_X_LEFT

public static final int POSITION_X_LEFT
Left horizontal positioning for bitmap backgrounds.

See Also:
Constant Field Values
Since:
BlackBerry API 4.6.0

POSITION_X_RIGHT

public static final int POSITION_X_RIGHT
Right horizontal positioning for bitmap backgrounds.

See Also:
Constant Field Values
Since:
BlackBerry API 4.6.0

POSITION_X_CENTER

public static final int POSITION_X_CENTER
Center horizontal positioning for bitmap backgrounds.

See Also:
Constant Field Values
Since:
BlackBerry API 4.6.0

POSITION_Y_INHERIT

public static final int POSITION_Y_INHERIT
Inherit vertical positioning for bitmap backgrounds.

See Also:
Constant Field Values
Since:
BlackBerry API 4.6.0

POSITION_Y_TOP

public static final int POSITION_Y_TOP
Top vertical positioning for bitmap backgrounds.

See Also:
Constant Field Values
Since:
BlackBerry API 4.6.0

POSITION_Y_BOTTOM

public static final int POSITION_Y_BOTTOM
Bottom vertical positioning for bitmap backgrounds.

See Also:
Constant Field Values
Since:
BlackBerry API 4.6.0

POSITION_Y_CENTER

public static final int POSITION_Y_CENTER
Center vertical positioning for bitmap backgrounds.

See Also:
Constant Field Values
Since:
BlackBerry API 4.6.0

REPEAT_INHERIT

public static final int REPEAT_INHERIT
Inherit bitmap tiling properties for bitmap backgrounds.

See Also:
Constant Field Values
Since:
BlackBerry API 4.6.0

REPEAT_NONE

public static final int REPEAT_NONE
Suppress bitmap tiling for bitmap backgrounds.

See Also:
Constant Field Values
Since:
BlackBerry API 4.6.0

REPEAT_HORIZONTAL

public static final int REPEAT_HORIZONTAL
Horizontal bitmap tiling for bitmap backgrounds.

Horizontal tiling means that the bitmap will be repeated in the horizaontal direction from the left edge to the right edge.

See Also:
Constant Field Values
Since:
BlackBerry API 4.6.0

REPEAT_VERTICAL

public static final int REPEAT_VERTICAL
Vertical bitmap tiling for bitmap backgrounds.

Vertical tiling means that the bitmap will be repeated in the vertical direction from the top edge to the bottom edge.

See Also:
Constant Field Values
Since:
BlackBerry API 4.6.0

REPEAT_BOTH

public static final int REPEAT_BOTH
Both horizontal and vertical bitmap tiling for bitmap backgrounds.

See Also:
Constant Field Values
Since:
BlackBerry API 4.6.0

REPEAT_SCALE_TO_FIT

public static final int REPEAT_SCALE_TO_FIT
Scale to fit bitmap for bitmap backgrounds.

See Also:
Constant Field Values
Since:
BlackBerry API 4.6.0


Constructor Detail

Background

protected Background()
Do not allow direct instantiation.

Since:
BlackBerry API 4.6.0


Method Detail

draw

public abstract void draw(Graphics graphics,
                          XYRect rect)
Invoked by paint methods in Field and Screen. This is an abstract method; any class that extends Background must implement this method appropriate to its needs.

Parameters:
graphics - Graphics context on which to draw.
rect - Bounding rectangle within graphics context.
Since:
BlackBerry API 4.6.0

isTransparent

public abstract boolean isTransparent()
Specifies whether the background is transparent. This is an abstract method; any class that extends Background must implement this method.

Returns:
True if background is transparent. False if background is opaque.
Since:
BlackBerry API 4.6.0





Copyright 1999-2010 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. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.