SHOW Colour
 

net.rim.device.api.ui.component
Class BitmapField

java.lang.Object
  |
  +--net.rim.device.api.ui.Field
        |
        +--net.rim.device.api.ui.component.BitmapField
All Implemented Interfaces:
AccessibleContext, DrawStyle, IComponent, InputMethodListener

public class BitmapField
extends Field
implements DrawStyle

Displays a bitmap.

By default this field uses only enough area to fit its contained bitmap. If you specify an alignment style at construction, the field always uses the full width of the controlling manager's layout.

Behaviour
Displays a bitmap. By specifying the Field.FOCUSABLE style at construction, you can make this field focusable.


Field Summary
 Category: Colour static int STAMP_MONOCHROME
          Stamp option.
 
Fields inherited from class net.rim.device.api.ui.Field
ACTION_INVOKE, EDITABLE, EDITABLE_MASK, FIELD_BOTTOM, FIELD_HALIGN_MASK, FIELD_HCENTER, FIELD_LEFT, FIELD_RIGHT, FIELD_TOP, FIELD_VALIGN_MASK, FIELD_VCENTER, FOCUSABLE, FOCUSABLE_MASK, HIGHLIGHT_FOCUS, HIGHLIGHT_SELECT, NON_FOCUSABLE, NON_SPELLCHECKABLE, READONLY, SPELLCHECKABLE, SPELLCHECKABLE_MASK, STATUS_MOVE_FOCUS_HORIZONTALLY, STATUS_MOVE_FOCUS_VERTICALLY, USE_ALL_HEIGHT, USE_ALL_WIDTH
 
Fields inherited from interface net.rim.device.api.ui.DrawStyle
BASELINE, BOTTOM, ELLIPSIS, HALIGN_MASK, HCENTER, HDEFAULT, HFULL, LEADING, LEFT, RIGHT, TOP, TRAILING, TRUNCATE_BEGINNING, VALIGN_MASK, VCENTER, VDEFAULT, VFULL
 
Constructor Summary
BitmapField()
          Constructs a new BitmapField instance.
BitmapField(Bitmap bitmap)
          Constructs a new BitmapField instance with provided bitmap.
BitmapField(Bitmap bitmap, long style)
          Constructs a new BitmapField instance with provided bitmap and alignment style.
 
Method Summary
protected  void drawFocus(Graphics graphics, boolean on)
          Draws the focus indicator for this field.
 int getBitmapHeight()
          Retrieves the height of this bitmap.
 int getBitmapWidth()
          Retrieves the width of this bitmap.
 int getPreferredHeight()
          Retrieves this field's preferred height.
 int getPreferredWidth()
          Retrieves this field's preferred width.
protected  void layout(int width, int height)
          Lays out this field's contents.
protected  void paint(Graphics graphics)
          Redraws this field.
 void setBitmap(Bitmap bitmap)
          Sets the bitmap for this field.
 void setImage(EncodedImage image)
          Sets the EncodedImage for this field.
 void setSpace(int hSpace, int vSpace)
          Sets the border region for this field.
 
Methods inherited from class net.rim.device.api.ui.Field
drawHighlightRegion, fieldChangeNotify, focusAdd, focusRemove, getChangeListener, getContentHeight, getContentLeft, getContentRect, getContentRect, getContentTop, getContentWidth, getContextMenu, getCookie, getExtent, getExtent, getFieldStyle, getFocusListener, getFocusRect, getFont, getHeight, getIndex, getLeafFieldWithFocus, getLeft, getManager, getOriginal, getScreen, getStyle, getTop, getWidth, invalidate, invalidate, invalidateAll, invokeAction, isDataValid, isDirty, isEditable, isFocus, isFocusable, isMuddy, isPasteable, isSelectable, isSelecting, isSelectionCopyable, isSelectionCutable, isSelectionDeleteable, isSpellCheckable, isStyle, isVisible, keyChar, keyControl, keyDown, keyRepeat, keyStatus, keyUp, makeContextMenu, moveFocus, moveFocus, navigationClick, navigationMovement, navigationUnclick, onDisplay, onExposed, onFocus, onMenuDismissed, onMenuDismissed, onObscured, onUndisplay, onUnfocus, onVisibilityChange, paste, select, selectionCopy, selectionCut, selectionDelete, setChangeListener, setCookie, setDirty, setEditable, setExtent, setFocus, setFocusListener, setFont, setMuddy, setNonSpellCheckable, setPosition, trackwheelClick, trackwheelUnclick, updateLayout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STAMP_MONOCHROME

public static final int STAMP_MONOCHROME
Stamp option. Bitmaps that are 1 bit (in the future, any monochrome) and have alpha defined, are used as a stamp. The non-transparent region will be rendered in the foreground color.
Since:
JDE 3.7.0
Category:
Colour: Pertains to devices' ability to display colour. May only be applicable on colour devices.
Constructor Detail

BitmapField

public BitmapField()
Constructs a new BitmapField instance.

This field uses the default style.


BitmapField

public BitmapField(Bitmap bitmap)
Constructs a new BitmapField instance with provided bitmap.

This field uses the default style.

Parameters:
bitmap - Bitmap to display in field.

BitmapField

public BitmapField(Bitmap bitmap,
                   long style)
Constructs a new BitmapField instance with provided bitmap and alignment style.

Use this method to build a bitmap with a specified alignment style. To build an alignment style value, you can combine one of VCENTER, TOP, and BOTTOM with one of HCENTER, LEFT, and RIGHT. If the horizontal alignments is DEFAULT (0), it will remain as DEFAULT, but behave as if it is LEFT. If the vertical alignment is DEFAULT (0), it will remain as DEFAULT, but behave as if it is TOP.

Note: If you want this field to be focusable, then you should also include Field.FOCUSABLE

Parameters:
bitmap - Bitmap to display in field.
style - Alignment style for this field.
Method Detail

drawFocus

protected void drawFocus(Graphics graphics,
                         boolean on)
Draws the focus indicator for this field.

This field's manager invokes this method after painting the field. Note that this method inverts only the bitmap itself, not the border region.

Overrides:
drawFocus in class Field
Parameters:
graphics - Graphics context for drawing the focus.
on - True if the focus should be set; otherwise, false.

getBitmapHeight

public int getBitmapHeight()
Retrieves the height of this bitmap.

Returns:
Height (in pixels) of this bitmap.

getBitmapWidth

public int getBitmapWidth()
Retrieves the width of this bitmap.

Returns:
Width (in pixels) of this bitmap.

getPreferredHeight

public int getPreferredHeight()
Retrieves this field's preferred height. See Field.getPreferredHeight() for more information.

This field's manager invokes this method to assist in its layout.

Overrides:
getPreferredHeight in class Field
Returns:
Preferred height (in pixels) of this field.

getPreferredWidth

public int getPreferredWidth()
Retrieves this field's preferred width. See Field.getPreferredWidth() for more information.

This field's manager invokes this method to assist in its layout.

Overrides:
getPreferredWidth in class Field
Returns:
Preferred width (in pixels) of this field.

layout

protected void layout(int width,
                      int height)
Lays out this field's contents.

This field's manager invokes this method during the layout process to instruct this field to arrange its contents, given an amount of available space.

Overrides:
layout in class Field
Parameters:
width - Amount of available horizontal space.
height - Amount of available vertical space.

paint

protected void paint(Graphics graphics)
Redraws this field.

This field's manager invokes this method during the repainting process to instruct this field to repaint itself. Note that invoking this method prompts a repaint of the entire bitmap contained in this field.

Overrides:
paint in class Field
Parameters:
graphics - Graphics context for repainting this field.

setBitmap

public void setBitmap(Bitmap bitmap)
Sets the bitmap for this field.

Provide a bitmap to this method to specify the image that this field should contain and display.

Using this method invokes Field.fieldChangeNotify(int), and marks the field as invalid (as long as this field is controlled by a valid manager).

Parameters:
bitmap - Bitmap image to display.

setImage

public void setImage(EncodedImage image)
Sets the EncodedImage for this field.

Provide an EncodedImage to this method to specify the image that this field should contain and display.

Using this method invokes Field.fieldChangeNotify(int), and marks the field as invalid (as long as this field is controlled by a valid manager).

Parameters:
image - EncodedImage to display.
Since:
JDE 3.7.0

setSpace

public void setSpace(int hSpace,
                     int vSpace)
Sets the border region for this field.

Use this method to specify the amount of horizontal and vertical padding placed around this field's contained bitmap image.

Parameters:
hSpace - Number of pixels of padding for both left and right sides.
vSpace - Number of pixels of padding for both top and bottom edges.



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.