net.rim.device.api.i18n
Class FieldPosition

java.lang.Object
  extended by net.rim.device.api.i18n.FieldPosition

public class FieldPosition
extends Object

Used by Format and its subclasses to identify fields in formatted output.

You can use this class's functionality to determine where a certain field starts in the formatted String buffer, which you could then use to position a change box over a given field.

Compatible with java.text.FieldPosition from Java's standard edition.


Constructor Summary
FieldPosition(int field)
          Constructs a new FieldPosition instance for a field.
 
Method Summary
 int getBeginIndex()
          Retrieves position of first character in underlying field.
 int getEndIndex()
          Retrieves position of last character in underlying field.
 int getField()
          Retrieves underlying field's ID.
 void setBeginIndex(int beginindex)
          Sets new first character mark.
 void setEndIndex(int endindex)
          Sets new last character mark.
 void setField(int field)
          Sets new underlying field.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

FieldPosition

public FieldPosition(int field)
Constructs a new FieldPosition instance for a field.

Parameters:
field - Underlying field for this field position instance.


Method Detail

getBeginIndex

public int getBeginIndex()
Retrieves position of first character in underlying field.

Returns:
Index of first character in underlying field.

getEndIndex

public int getEndIndex()
Retrieves position of last character in underlying field.

Returns:
Index of last character in underlying field.

getField

public int getField()
Retrieves underlying field's ID.

Returns:
Underlying field's ID.

setField

public void setField(int field)
Sets new underlying field.

Invoke this method to set a new underlying field for this position object; this can help you avoid instantiating unnecessary position objects.

Parameters:
field - ID of new underlying field.

setBeginIndex

public void setBeginIndex(int beginindex)
Sets new first character mark.

Invoke this method to specify the "first" character in the underlying field. Once set, FieldPosition.getBeginIndex() returns this value.

Parameters:
beginindex - New first character mark for the underlying field.

setEndIndex

public void setEndIndex(int endindex)
Sets new last character mark.

Invoke this method to specify the "last" character in the underlying field. Once set, FieldPosition.getEndIndex() returns this value.

Parameters:
beginindex - New last character mark for the underlying field.





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal