As
we have discussed before we will discuss the new APIs of MIDP 2.0 is this
section. The following are the four new packages that have been added in MIDP
2.0:
Public Key
Package:
ü javax.microedition.pki
Sound and
Tone Media Packages:
ü javax.microedition.media
ü javax.microedition.media.control
Gaming
Package:
ü javax.microedition.lcdui.game
We will
now discuss the above listed packages in detail. We will not discuss the javax.microedition.lcdui.game
package here as the gaming package has been discussed in the next chapter in
great detail.
javax.microedition.pki
The certificates are needed to authenticate information for
securing the connections. The Certificate interface in the
javax.microedition.pki package provides to the application information about
the origin and type of the certificate. The class CertificateException provides
us the information about failures that have occurred while verifying or using the
certificates. The MIDP 2.0 specification has made it compulsory for device
manufacturers to support X.509 certificates in there javax.microedition.pki
package implementation. The device may also support other types of certificates
but there support is optional. It has also been made compulsory for the device
to support RSA signature algorithm with SHA-1 hash function while implementing
the javax.microedition.pki package.
public interface Certificate
What is it?
The
Certificate interface is common to all certificates. The Certificate interface has
features such as :
- Issuer
- Dates of valid use
- Serial number
- Signing algorithm name
- Subject
- Type
- Version
- Serial number.
This interface provides the getter methods for the above discussed
features.
o Methods
·
public java.lang.String getIssuer()
This method returns the name of issuer of this Certificate. This value
should not be null for a valid certificate.
·
public long getNotAfter()
This method returns the time (in
milliseconds) after which this Certificate is not valid (i.e. the expiry date).
The value for Long.MAX_VALUE is returned if the certificate does not have a
time based restriction on its validity. The value returned is always positive.
·
public long getNotBefore()
This method returns the time (in
milliseconds) before which this Certificate is not valid. The value 0 is
returned if the certificate does not have a time based restriction on its
validity. The value returned is always positive.
·
public java.lang.String getSerialNumber()
This method returns a string
containing the serial number in a user friendly form. This method returns a null
value if there is no serial number in the certificate.
·
public java.lang.String getSigAlgName()
This getter method returns the name
of algorithm that is used to sign the certificate. This value being very
important for reading the certificate can not be null.
·
public java.lang.String getSubject()
This method gets the name of the subject of this Certificate.
The value being important can not be null.
·
public java.lang.String getType()
This method returns the type of the Certificate.
The value being important can not be null. For a X.509 certificate this method
will return ‘X.509’
·
public java.lang.String getVersion()
This method returns the version
number of the Certificate. The value being important can not be null. For a
X.509 certificate this method will return ‘2’.
public class CertificateException extends
java.io.IOException
What is it?
o
The CertificateException is
thrown when a problem is encountered while a Certificate is being used. In case
multiple errors are found while processing a Certificate the most significant
error should be reported in the CertificateException.
o Constructors
·
public CertificateException(Certificate
certificate, byte status)
·
public CertificateException(String
message, Certificate certificate,byte status)
o Fields
·
public
static final byte BAD_EXTENSIONS
This field indicates that a
certificate has unrecognized critical extensions.
Value:
1
·
public
static final byte BROKEN_CHAIN
This field indicates that a certificate in a chain was not issued by the next
authority in the chain. Value: 11.
·
public
static final byte CERTIFICATE_CHAIN_TOO_LONG
This field indicates that the server certificate chain exceeds the length
allowed by an issuer’s policy.
Value: 2.
·
public
static final
byte EXPIRED
This
field indicates that a certificate is expired.
Value: 3.
·
public
static final byte INAPPROPRIATE_KEY_USAGE
This field indicates that a certificate
public key has been used in way deemed inappropriate by the issuer.
Value:
10.
·
public
static final byte MISSING_SIGNATURE
This field indicates that a certificate
public key has been used in way deemed inappropriate by the issuer.
Value: 10.
·
public
static final byte
NOT_YET_VALID
This
field indicates that a certificate is not yet valid.
Value: 6.
·
public
static final byte ROOT_CA_EXPIRED
This
field indicates that the root CA’s public key is expired.
Value: 12.
·
public
static final byte SITENAME_MISMATCH
This
field indicates that a certificate does not contain the correct site name.
Value: 7.
·
public
static final byte UNAUTHORIZED_INTERMEDIATE_CA
This field indicates that an intermediate certificate in the chain does not
have the authority to be a intermediate CA.
Value: 4.
·
public
static final byte UNRECOGNIZED_ISSUER
This
field indicates that a certificate was issued by an unrecognized entity.
Value: 8.
·
public
static final byte UNSUPPORTED_PUBLIC_KEY_TYPE
This field indicates that the type
of the public key in a certificate is not supported by the device.
Value: 13.
·
public
static final byte UNSUPPORTED_SIGALG
This
field indicates that a certificate was signed using an unsupported algorithm.
Value: 9.
·
public
static final byte VERIFICATION_FAILED
This
field indicates that a certificate failed verification.
Value: 14.
o Methods
·
public Certificate getCertificate()
This method returns the Certificate was the cause of failure.
·
public byte getReason()
This method returns the reason code for the failure. The reason codes have
been discussed in detail above.
javax.microedition.media
One of the key problems with the MIDP 1.0 was that it was
lacking the in built support of multimedia APIs. To solve this problem MIDP 2.0
has provisioned for a Media API. But Sun had also introduced Mobile Media API
(JSR 135). To solve the problem of interoperability the MIDP 2.0 Media API is
directly compatible with Mobile Media API (JSR-135) specification. The
compatibility of MIDP 2.0 API with the Mobile Media API is a step in the right
direction and makes it easier for the developers to scale up there application
and use Mobile Media API in devices which support it.
The MIDP 2.0 Media APIs give us a good set of tools to
use multimedia in our applications. This API gives us the player and control
functionality for use in our code. Although the number of controls available to
us a very few when compared to Mobile Media API but at least it is enough for
basic games.
1. Wave audio files: audio/x-wav
2. AU audio files: audio/basic
3. MP3 audio files: audio/mpeg
4. MIDI files: audio/midi
5. Tone sequences: audio/x-tone-seq
public interface Control
What is it?
o An object which implements Control object is used to control some sort of media
processing functions. It is normal for one object to implement multiple
controls. An example of type of Control is VolumeControl which is used to
control the volume of the player.
public interface Controllable
What is it?
o The Controllable interface provides us with the tool for obtaining the Controls
from an object like a Player. Controllable interface provides methods to get
all the supported Controls in an object or to obtain a specific Control based on
its class name.
o Methods
- public Control getControl(String controlType)
This method returns an object that implements the control
or null value.
- public
Control[] getControls()
This method returns to us the
collection of Control objects.
public final class Manager
What is it?
- The Manager class provides us convenience of obtaining system
dependent resources such as Players for multimedia processing.
o
Fields
- public static
final String TONE_DEVICE_LOCATOR
This field refers to the locator to create a tone player to
play back tone sequences.
o
Methods
- public static javax.microedition.media.Player createPlayer(java.io.InputStream
stream,String type)
This method returns a new Player from the specified
inputstream.
- public static javax.microedition.media.Player createPlayer(String locator)
throws IOException, MediaException
This method returns a new Player from the specified media
locator string.
- public static String[] getSupportedContentTypes(String
protocol)
This method returns the list of supported content types
for the given protocol.
- public static String[] getSupportedProtocols(String
content_type)
This method returns the list of supported protocols for
the given content type.
- public static void playTone(int note, int
duration, int volume)
throws MediaException
This method plays back a tone as specified by a note and
its duration. Notes range from 0 to 127 inclusive.
public class MediaException
What is it?
- This class indicates an unexpected error condition in a method.
o
Constructors
- publicMediaException(String
reason)
public interface Player extends Controllable
What is it?
- The Player interface
helps us control the rendering of time based media data. It provides the following
functionality:
- Management of
the Player’s life cycle
- Controlling the
progress of playback
- Obtaining the components
for presentation
The
following are the states in which a Player can be:
- UNREALIZED
- REALIZED
- PREFETCHED
- STARTED
- CLOSED
o
Fields
- public static
final int CLOSED
This field indicates that the Player is closed.
Value: 0
- public
static final int PREFETCHED
This field indicates that the Player has acquired all the
resources to begin playing.
Value: 300
- public
static final int REALIZED
This field indicates that it has acquired the required
information but not the resources to function.
Value: 200
- public
static final int STARTED
This field indicates that the Player has already started.
Value: 400
- public
static final long TIME_UNKNOWN
This field indicates that the requested time is unknown.
Value: -1
- public
static final int UNREALIZED
This field indicating that the Player has not acquired
the required information and resources to function properly.
Value: 100
o
Methods
- public void addPlayerListener(PlayerListener
playerListener)
This method adds a player listener for this player.
This method closes the Player and releases its resources.
This method releases the scarce/exclusive resources like
the audio device acquired by the Player.
- public
String getContentType()
This method returns the content type being played back by
this Player.
- public
long getDuration()
This method returns the duration in microseconds or TIME_UNKNOWN.
- public
long getMediaTime()
This method returns the current media time in microseconds
or TIME_UNKNOWN.
This method returns the Player’s current state.
This method makes the player acquire the scarce and exclusive
resources and process as much data as necessary to reduce the start latency.
This method constructs portions of the Player without
acquiring the scarce and exclusive resources.
- public
void removePlayerListener(PlayerListener playerListener)
This method removes a player listener for this player.
- public
void setLoopCount(int count)
This method sets the number of times the Player should
loop and play the content.
- public
long setMediaTime(long now)
This method returns the actual media time set in
microseconds
This method starts the Player as soon as possible for it
to start. If the Player was previously stopped by calling stop, this method
will resume playback from where it was previously stopped.
This method stops the Player. This method will pause the
playback at the current media time.
public interface PlayerListener
What is it?
- A PlayerListener
is the interface that receives asynchronous events generated by Players.
The J2ME applications can implement this interface and register their
implementations of the interface with the addPlayerListener() method in
Player.
o
Fields
- public static String
CLOSED
This field is posted when a Player is closed.
- public
static String DEVICE_AVAILABLE
This field is posted when the system
or another higher priority application has released an exclusive device which
is now available to the Player.
- public
static String DEVICE_UNAVAILABLE
This field is posted when the system or another higher
priority application has temporarily taken control of an exclusive device which
was previously available to the Player.
- public
static String DURATION_UPDATED
This field is posted when the duration of a Player is
updated. This happens for those media types where the duration cannot be
derived ahead of time.
- public
static String END_OF_MEDIA
This field is posted when a Player has
reached the end of the media.
- public
static String ERROR
This field is posted when an error
has occurred.
- public static String
STARTED
This field is posted when a Player is started.
- public
static String STOPPED
This field is posted when a Player stops in response to
the stop method call.
- public
static String VOLUME_CHANGED
This field is posted when the volume of an audio device
is changed.
o
Method
- public void playerUpdate(Player
player, String event,Object eventData)
The method playerUpdate(Player player, String
event,Object eventData) is called to deliver an
event to a registered listener when an event for the specified Player is
observed.
javax.microedition.media.control
The javax.microedition.media.control package
defines the specific types of controls that can be used with a Player.
public
interface ToneControl extends javax.microedition.media.Control
o
Programmer specified monotonic
tone
sequences can be generated with the help of this
interface
o
Fields
·
public static final byte BLOCK_END
This
field defines an ending point for a block.
Value: -6
·
public static final byte BLOCK_START
This
field defines a starting point for a block.
Value: -5
·
public static final byte C4
This
field stands for the Middle C.
Value: 60
·
public static final byte PLAY_BLOCK
This
field plays a defined block.
Value: -7
·
public static final byte REPEAT
This
field stands for the REPEAT event tag.
Value: -9
·
public static final byte RESOLUTION
This
field stands for the RESOLUTION event tag.
Value: -4
·
public static final byte SET_VOLUME
This
field stands for the SET_VOLUME event tag.
Value: -8
·
public static final byte SILENCE
This
field stands for the Silence.
Value: -1
·
public static final byte TEMPO
This
field stands for the TEMPO event tag.
Value: -3
·
public static final byte VERSION
This
field stands for the VERSION attribute tag.
Value: -2
o
Methods
·
public void setSequence(byte[]
sequence)
This
method sets the tone sequence that has to be played.
public
interface VolumeControl
What is
it?
o
The interface VolumeControl provides us
methods for manipulating the audio volume of a Player.
o
Methods
·
public int getLevel()
This
method returns the current volume level or -1.
·
public boolean isMuted()
This
method returns the mute state.
·
public int setLevel(int level)
This
method returns the level that was actually set by this method.
·
public void set Mute(boolean mute)
This
method sets the mute status of the Player associated with this VolumeControl.
javax.microedition.io
The javax.microedition.io package provides us with the tools
to use the following types of connections:
·
HTTP Networking
javax.microedition.io.HttpConnection
is used for working with HTTP connections. MIDP 2.0 enabled device must support
the HTTP 1.1 servers and services.
·
Secure Connections
javax.microedition.io.HttpsConnection
is used for working with secure connections.
·
Low Level Networking
Support
The MIDP 2.0 specification also
supports the TCP/IP sockets and the UDP/IP datagrams.
·
Push Applications
Support
MIDP 2.0 includes the support for
PushRegistry. The PushRegistry maintains a list of inbound connections.
Whenever the application management software receives a notification for a
MIDlet that has registered itself for inbound notifications the particular
MIDlet is started by the application management software. This feature can be
used for chat, news and ERP applications.
·
Serial Port Connections
We can access the local serial port
in form of a stream connection with the help of the interface javax.microedition.io.CommConnection.
The networking support in this package is based on the
Generic Connection Framework provided to us in the Connected, Limited Device
Configuration.
public interface CommConnection
What is it?
o
A logical serial port connection
is defined by the interface javax.microedition.io.CommConnection. A logical
serial port may be a RS – 232 port or an IrDA IRCOMM port. One serial port can
be used by only one application at a particular time.
What is a logical serial port?
A logical connection through which
bytes are transferring serially can be termed as a logical serial port.
o Methods
·
public int getBaudRate()
This method returns the baud rate of the connection.
·
public int setBaudRate(int
baudrate)
This method is used for setting the baud rate for a
serial port connection. This method returns the previous baud rate of
the connection.
public class Connector
What is it?
Connector is a factory class for
creating new Connection objects. This class dynamically returns the appropriate
type on Connection based upon the value of the arguments in its open method.
o Fields
·
public static final int READ
The field for the access mode READ.
Value: 1
·
public static final int READ_WRITE
READ_WRITE is the field for the access mode READ_WRITE.
Value: 3
·
public static final int WRITE
WRITE is the field for the access mode WRITE.
Value: 2
o Methods
·
public static
javax.microedition.io.Connection open(String name)
This method returns a new Connection object.
·
public static
javax.microedition.io.Connection open(String name, int mode)
This method returns a new Connection object.
·
public static
javax.microedition.io.Connection open(String name, int mode, boolean
timeouts)
This method returns a new Connection object
·
public static java.io.DataInputStream
openDataInputStream(String name)
This method returns a DataInputStream.
·
public static
java.io.DataOutputStream openDataOutputStream(String name)
This method returns a DataOutputStream.
·
public static
java.io.InputStream openInputStream(String name)
This method returns an InputStream.
·
public static
java.io.OutputStream openOutputStream(String name)
This method returns an OutputStream.
public interface HttpsConnection
What is it?
HttpsConnection defines the
necessary methods and constants to establish a secure network connection.
What is HTTPS?
HTTPS protocol is the secure version
of HTTP protocol. It is a request-response protocol in which the parameters of
request must be set before the request is sent.
o Methods
·
public int getPort()
This method returns the network port
number of the URL for this HttpsConnection. If no port number is passed in the
string is passed to Connector.open then the default HTTPS port number (443) is
returned.
·
public SecurityInfo getSecurityInfo()
This method returns the security
information associated with this open connection.
public interface SecureConnection
What is it?
o SecureConnection interface defines the secure socket stream connection. A CertificateException
is thrown if the secure connection cannot be established due to errors related
to certificates.
o Methods
·
public SecurityInfo getSecurityInfo()
This method returns the security information associated
with this open connection.
public interface SecurityInfo
What is it?
o SecurityInfo
interface provides us with the methods to access information about a secure network
connection. This interface provides the following:
· Protocol
· Version
· Certificate
· Cipher
suite
o Methods
·
public java.lang.String getCipherSuite()
This method returns a String containing the name of the
cipher suite in use.
·
public java.lang.String getProtocolName()
This method returns the name of the secure protocol.
The following are the return values for the respective
connections:
·
TLS (RFC 2246) /WAP TLS
Profile and Tunneling (WAP-219-TLS)
Return value: “TLS”
·
SSL V3 (The SSL Protocol
Version 3.0)
Return value: “SSL”
·
WTLS (WAP 199)
Return value: “WTLS”.
·
public java.lang.String getProtocolVersion()
This method returns a String containing the version of
the protocol.
·
public
javax.microedition.pki.Certificate getServerCertificate()
This method returns the Certificate used to establish the
secure connection with the server.
public interface ServerSocketConnection
What is it?
o ServerSocketConnection
interface defines the server socket stream connection.
o Methods
·
public java.lang.String getLocalAddress()
This method returns the local address to which this
socket is bound.
·
public int getLocalPort()
This method returns the local port number to which the
socket is connected.
public interface SocketConnection
What is it?
o SocketConnection
defines the socket stream connection.
o Fields
- public static final byte DELAY
·
public
static final byte KEEPALIVE
·
public
static final byte LINGER
·
public
static final byte RCVBUF
·
public
static final byte SNDBUF
o Methods
- public java.lang.String getAddress()
This method returns the remote address to which the socket
is bound.
·
public
java.lang.String getLocalAddress()
This method returns the local address to which the socket
is bound.
·
public
int getLocalPort()
This method returns the local port number to which this
socket is connected.
·
public
int getPort()
This method returns the remote port number to
which this socket is connected.
·
public
int getSocketOption(byte option)
This method returns numeric value for specified
option or -1 if the value is not available.
·
public
void setSocketOption(byte option, int value)
This method is used for setting a socket option for the
connection.
public interface UDPDatagramConnection
What is it?
o
UDPDatagramConnection
interface defines a datagram connection. This protocol is transaction oriented
and the delivery can not be guaranteed.
o Methods
- public String getLocalAddress()throws
Exception
This method returns the local
address to which the datagram connection is bound.
·
public int getLocalPort()throws
Exception
This method returns the local
port number to which this datagram connection is connected.
public class PushRegistry
What is it?
This class maintains a list of inbound
connections. An application can register for the inbound connections by the
following ways:
· Entry
in the application descriptor file
· By
calling the registerConnection method
When an application is not running, the application management
software (AMS) keeps the track for inbound notification requests. When a
notification arrives for a MIDlet that has registered itself, AMS will start
that MIDlet normally through the startApp method. When the application is
running, the application is responsible for all input and output operations
associated with the inbound connection.
o Methods
- public static
java.lang.String getFilter(String
connection)
This method returns a filter
string indicating which senders are allowed to cause the MIDlet to be launched.
If the connection was not registered by the current MIDlet suite or if the
connection argument was containing null this method will return null.
- public static java.lang.String getMIDlet(String
connection)
This method returns class
name of the MIDlet to be launched when the new external data is available. If
the connection was not registered by the current MIDlet suite or if the
connection argument was containing null this method will return null.
- public static java.lang.String[] listConnections(boolean
available)
This method returns array of
registered connection strings.
- public static long registerAlarm(String
midlet, long time)
This method returns the time
at which the most recent execution of this MIDlet was scheduled to occur. The
format is the same as returned by Date.getTime()
- public static void registerConnection(String
connection, String midlet, Stringfilter)
This method register’s a dynamic
connection with the application management software (AMS). Once a connection is
registered, the dynamic connection acts just like a connection pre-allocated
from the descriptor file.
- public static boolean unregisterConnection(String
connection)
This method returns true if
the un-registration process was successful or it returns false if the
connection was not registered or if the connection argument was null.
javax.microedition.lcdui
In MIDP 2.0 many new
changes have been introduced in javax.microedition.lcdui package. Some classes
have been introduced for the first time. All the methods and fields have been
given for such classes. Some of the existing classes and interfaces have also
been changed. For these classes and interfaces, I have at some places given
only the additions made by MIDP 2.0 and at some other places given all the
methods or fields as the need arose. For example in case of Alert only the new
additions are given while in case of Canvas all the methods are given for a
better understanding. I would also recommend you to read the appendix D of this
book which contains the short description and a list of all the fields and
methods of each and every interface and class in MIDP 1.0.
public class Alert
What is it
The alert class
is a kind of screen that shows some data to the user. It waits for a certain
period of time before proceeding to the next Displayable. It is basically a
sort of simple dialog box that only gives some information.
o Fields
- public
static final Command DISMISS_COMMAND
DISMISS_COMMAND is a Command that is
delivered to a command listener to indicate that the Alert has been dismissed.
o Methods
·
public javax.microedition.lcdui.Gauge
getIndicator()
This method returns a
reference to this Alert's activity indicator. It returns null if there is no
indicator in the alert.
·
public void removeCommand (javax.microedition.lcdui.Command
cmd)
The important thing to keep in mind
while using this method is that calling this method with DISMISS_COMMAND as the
parameter has no effect.
·
public void setIndicator (javax.microedition.lcdui.Gauge
indicator)
This method sets an activity
indicator on this Alert.
public abstract class Canvas
What is it?
This class
is the base class for applications that need to handle low-level events and to
issue graphics calls for drawing to the display. This class is very useful for
graphics programming.
o Methods
·
public int getGameAction(int keyCode)
This method returns the game action for this key.
It will return 0 if no game action is there for the key.
This method returns height of the displayable area.
The value returned by this method can change during the execution of the
application due variety of factors. The sizeChanged method has been added in
MIDP 2.0 to notify us when the size of the displayable area is changed.
- public
int getKeyCode(int gameAction)
This method returns a key code corresponding to
the game action given in the argument.
- public
java.lang.String getKeyName(int keyCode)
This method returns a string name for the key
specified in the keyCode argument.
This method returns width of the displayable area.
The value returned by this method can change during the execution of the
application due variety of factors. The sizeChanged method has been added in
MIDP 2.0 to notify us when the size of the displayable area is changed.
- public
boolean hasPointerEvents()
This method returns true if device supports
pointer events.
- public
boolean hasPointerMotionEvents()
This method returns true if device supports
pointer motion events.
- public
boolean hasRepeatEvents()
This method returns true if device supports repeat
events
- public
protected void hideNotify()
This method is called shortly after the Canvas has been
removed from the display.
- public
boolean isDoubleBuffered()
This method returns true if double buffering is
there else this method will return false.
- protected
void keyPressed(int keyCode)
This method is called when a key is pressed.
- protected
void keyReleased(int keyCode)
This method is called when a key is released.
- protected
void keyRepeated(int keyCode)
This method is called when a key is repeated (held down).
- protected
abstract void paint(Graphics g)
This method is called for rendering the Canvas.
- protected
void pointerDragged(int x, int y)
This method is called when the pointer is dragged.
- protected
void pointerPressed(int x, int y)
This method is called when the pointer is pressed.
- protected
void pointerReleased(int x, int y)
This method is called when the pointer is released.
This method requests a repaint for the entire Canvas.
- public
void repaint(int x, int y, int width, int height)
This method is requests a repaint for the specified
region of the Canvas.
- public
void serviceRepaints()
This method forces any pending repaint requests to be
serviced immediately.
·
public void setFullScreenMode(boolean mode)
This method provides us with a much desired control over
the full screen mode of the Canvas. For setting the full screen mode the
argument should be true otherwise it should be false.
- protected
void showNotify()
The showNotify () method is called immediately prior to
this Canvas being made visible on the display.
- protected
void sizeChanged(int w, int h)
This method is called when the area of the Canvas which
can be used for drawing upon has been changed. This method can be called due to
a variety of factors.
public interface Choice
What is it?
This
interface defines the characteristics of a user interface component implementing
selection from predefined number of choices.
o
Fields
- public static
final int EXCLUSIVE
This field stands for EXCLUSIVE choice. This kind of user
interface element has exactly one element selected at one time.
- public
static final int IMPLICIT
This field stands for IMPLICIT choice. In this kind of
user interface element the currently focused element is selected when a Command
is initiated.
- public
static final int MULTIPLE
This field stands for MULTIPLE choices.
This kind of user interface element can have an arbitrary number of elements
selected at a given time.
- public
static final int POPUP
This is a new field that has been
added in MIDP 2.0. This is kind of a choice having exactly one element selected
at one time and only this selected option is displayed until the user performs
the particular action that will make all the elements visible. This choice type
is not valid type for List class.
- public
static final int TEXT_WRAP_DEFAULT
This is a new field that has been
added in MIDP 2.0. This field indicates that the application has no preference
as to wrapping or truncation of text element contents and that the
implementation should use its default behavior.
- public
static final int TEXT_WRAP_OFF
This is a new field that has been
added in MIDP 2.0. This field indicates that text element contents should be
limited to a single line.
- public
static final int TEXT_WRAP_ON
This is a new field that has been
added in MIDP 2.0. This field indicates that text element contents should be
wrapped to multiple lines if necessary to fit available content space.
o Methods
This method deletes all the elements from this Choice.
- public
int getFitPolicy()
This method gets the application’s preferred policy for
fitting Choice element contents to the available screen space. This method will
return one of the 3 options given below:
· public
static final int TEXT_WRAP_DEFAULT
· public
static final int TEXT_WRAP_OFF
· public
static final int TEXT_WRAP_ON
- public
Font getFont(int elementNum)
This method returns the preferred font to use to
render the specified element.
- public
void setFitPolicy(int fitPolicy)
This method sets the application’s preferred policy for
fitting Choice element contents to the available screen space. This method can
contain one of the 3 options given below in its argument:
· public
static final int TEXT_WRAP_DEFAULT
· public
static final int TEXT_WRAP_OFF
· public
static final int TEXT_WRAP_ON
Note
This method can only
give its recommendation to the device. The actual policy will be dependent on
the particular device.
- public
void setFont(int elementNum, Font font)
This method sets the preferred font for rendering the
specified element of this Choice.
public class ChoiceGroup
What is
it?
The
changes in ChoiceGroup are mainly due to the changes in Interface Choice which
is implemented in ChoiceGroup and class Item, which is the super class of
ChoiceGroup. The changes in Choice and Item are given in detail in there
respective texts.
public class Command
What is
it?
This
class encapsulates the semantic information of an action. The implementation of
Command is device dependent. On some devices the commands are displayed on soft
keys while on others they are shown in form of menus and lists. Thus care
should be taken of testing the reaction of devices on adding commands.
Generally the devices add the first 2 commands above the soft keys.
o Constructors
- public
Command(String shortLabel, String longLabel, int commandType,int priority)
This constructor constructs a new
command object with the given long and short labels, type and priority.
o Methods
- public
java.lang.String getLongLabel()
This method returns the Command's long
label. If the command has no long label a null is returned.
public abstract class CustomItem
What is
it?
One
of the problems in MIDP 1.0 was that we could not create customized items. To
eliminate this problem the CustomItem has been introduced. This class is
customizable by sub classing to introduce new kinds of visual and interactive
elements into Forms. This class is very similar to the Canvas class but it has
been written keeping in mind that sub classes of this class will be appended to
forms.
o Constructors
·
public protected CustomItem(String label)
This constructor has been provided so that the CustomItem
subclass can specify its label.
o Fields
- protected public static final
int KEY_PRESS
Value: 4.
- protected public static final int KEY_RELEASE
Value: 8.
- protected public static final int KEY_REPEAT
Value: 0x10.
- protected public static final int NONE
Value: 0.
- protected public static final int POINTER_DRAG
Value: 0x80.
- protected public static final int POINTER_PRESS
Value: 0x20.
- protected public static final int POINTER_RELEASE
Value: 0x40.
- protected public static final int TRAVERSE_HORIZONTAL
Value: 1.
- protected public static final int TRAVERSE_VERTICAL
Value: 2.
o Methods
·
public int getGameAction(int keyCode)
This method returns the game action
corresponding to the key specified in this argument. It returns 0 if no game
action is there for this key.
- protected
int getInteractionModes()
This method returns a bit mask
of the available interaction modes
- protected
abstract int getMinContentHeight()
This method returns the
minimum content height in pixels.
- protected
abstract int getMinContentWidth()
This method returns the
minimum content width in pixels.
- protected
abstract int getPrefContentHeight(int
width)
This method returns the
preferred content height in pixels.
- protected
abstract int getPrefContentWidth(int
height)
This method returns the
preferred content width in pixels.
- protected
void hideNotify()
This method is called by the system
to notify that the item is now completely invisible. No further calls to the paint()
method will be made on this item until after a showNotify() has been called
again.
- protected
void invalidate()
This method signals that the CustomItem's
size and traversal location need to be updated.
- protected
void keyPressed(int keyCode)
This method is called by the system
when a key is pressed.
- protected
void keyReleased(int keyCode)
This method is called by the system
when a key is released.
- protected
void keyRepeated(int keyCode)
This method is called by the system
when a key is repeated.
- protected
abstract void paint(Graphics g, int w, int h)
This method will be called to render
the sub class of CustomItem. This method will be called only if the height and
width of the CustomItem is greater than 0.
- protected
void pointerDragged(int x, int y)
This method is called by the system
when a pointer drag action has occurred within the item. The x and y coordinates
of this method are relative to the origin of the item.
- protected
void pointerPressed(int x, int y)
This method is called by the system
when a pointer down action has occurred within the item. The x and y coordinates
of this method are relative to the origin of the item.
- protected
void pointerReleased(int x, int y)
This method is called by the system
when a pointer up action has occurred after a pointer down action had occurred
within the item. The x and y coordinates of this method are relative to the
origin of the item.
This method is called by subclass
code to request that the item needs to be repainted.
- protected
void repaint(int x, int y, int w, int h)
This method is called by subclass
code to request that the specified rectangular area of the item needs to be
repainted.
- protected
void showNotify()
This method is called by the system
to notify the item that it is now at least partially visible.
- protected
void sizeChanged(int w, int h)
This method is implemented by the
subclass in order to handle size change events.
- protected
boolean traverse(int dir, int viewportWidth, int
viewportHeight,int[] visRect_inout)
This method is called by the system
when traversal has entered the item or has occurred within the item.
- protected
void traverseOut()
This method is called by the system
when traversal has occurred out of the item.
public class Display
What is it?
The class Display represents the manager of the display and
input devices of the system and it also includes methods for retrieving
properties of the device and for requesting that objects be displayed on the
device.
o
Fields
- public
static final int ALERT
This field represents the Image type
for Alert image.
- public
static final int CHOICE_GROUP_ELEMENT
This field represents the Image type
for ChoiceGroup element image.
- public
static final int COLOR_BACKGROUND
This field specifies the color type for
use with getColor method. This field specifies the background color of the
screen.
- public
static final int COLOR_BORDER
This field specifies the color type for
use with getColor method. This field specifies the color for boxes and borders
when the object is to be drawn in a non-highlighted state.
- public
static final int COLOR_FOREGROUND
This field specifies the color type for
use with getColor method. This field specifies the foreground color, for text
characters and simple graphics on the screen.
- public
static final int COLOR_HIGHLIGHTED_BACKGROUND
This field specifies the color type for
use with getColor method. This field specifies the color for the focus or focus
highlight, when it is drawn as a filled in rectangle.
- public
static final int COLOR_HIGHLIGHTED_BORDER
This field specifies the color type for
use with getColor method. This field specifies the color for boxes and borders
when the object is to be drawn in a highlighted state.
- public
static final int COLOR_HIGHLIGHTED_FOREGROUND
This field specifies the color type for
use with getColor method. This field specifies the color for text characters
and simple graphics when they are highlighted.
- public
static final int LIST_ELEMENT
This field represents the Image type
for List element image.
o Methods
·
public void callSerially(Runnable r)
This method causes the r (Runnable object)
to have its run () method called later, serialized with the event stream soon
after the completion of repaint cycle.
- public
boolean flashBacklight(int duration)
This method requests a flashing
effect for the device’s backlight. This method is quite useful in games and can
be used to attract the user’s attention or as a special effect for games.
- public
int getBestImageHeight(int imageType)
This method returns the best
image height for the image type. The return value may be zero if there is no
best size. The return value will never be negative.
- public
int getBestImageWidth(int imageType)
This method returns the best
image width for the image type. The return value may be zero if there is no
best size. The return value will never be negative.
- public
int getBorderStyle(boolean highlighted)
This method returns the stroke
style for drawing the border. This method will return either of the
following:
· Graphics.DOTTED
· Graphics.SOLID
- public
int getColor(int colorSpecifier)
This method returns specified
kind of color from high level user interface color scheme in the form of 0x00RRGGBB.
- public
Displayable getCurrent()
This method returns the MIDlet's
current Displayable object
- public
static Display getDisplay(javax.microedition.midlet.MIDlet m)
This method returns the
display object that application can use for its user interface.
This method returns true if
the display supports color else it will return false.
- public
int numAlphaLevels()
This method returns number
of alpha transparency levels supported. This method will at least return a
value of 2 which stands for full transparency and full opacity. In case alpha
blending is supported this value will be greater than 2.
This method returns number of
colors a device can support. If the isColor () method has returned false then
this method will give the number of grayscale values this device supports.
- public
void setCurrent(Alert alert, Displayable nextDisplayable)
This method requests that this Alert
be made current Displayable and that next Displayable be made current after the
Alert is dismissed.
- public
void setCurrent(Displayable nextDisplayable)
This method requests that a
different Displayable object shall be made visible on the display.
- public
void setCurrentItem(Item item)
This method requests that the Displayable
that contains this Item be made current. This method scrolls the Displayable so
that this Item is visible and if possible assigns the focus to the Item passed
in the argument.
- public
boolean vibrate(int duration)
This method is used for vibrating
the device for a specified number of milliseconds. If we want to switch off the
vibrator then we should pass 0 in the argument for this method. This method
returns true if the vibrator can be controlled by the application and this
display is in the foreground else it returns false.
public abstract class Displayable
What is it?
Any class which needs to be placed on the display should
be a sub class of this class. A Displayable object may have the following:
· Title
· Ticker
· Zero or more commands
· A command listener associated with
it.
The sub classes of this class define the contents to be displayed
and their interaction with the users.
o Methods
·
public void addCommand(Command cmd)
This method adds the specified
command to the Displayable. One command can not be added more than once on a
Displayable even by calling this method repeatedly.
This method returns height of the area available
to the application.
- public
Ticker getTicker()
This method returns ticker object used. This
method returns a null value if no ticker is present in this Displayable.
- public
java.lang.String getTitle()
This method returns the title. It returns a null if
no title is there.
This method returns width of the area available to
the application.
This method returns true if this Displayable is
currently visible.
- public
void removeCommand(Command cmd)
This method removes the specified command from the Displayable.
If the same command is repeatedly removed from the Displayable this method will
have no effect.
- public
void setCommandListener(CommandListener l)
This method sets a listener for Commands to this Displayable,
replacing any previous CommandListener.
- public
void setTicker(Ticker ticker)
This method sets a ticker for use with this Displayable.
In the process it removes any previous ticker.
- public
void setTitle(String s)
This method sets the title of the Displayable. If null is
given is the argument this method removes the title.
- protected
void sizeChanged(int w, int h)
The implementation calls the sizeChanged (int w,
int h) method when the available area of the Displayable has
changed.
public final class Font
What is it?
One peculiar feature of MIDP 1.0 as well as MIDP 2.0 is
that applications can not create there own fonts. The application can only
demand particular kind of fonts and if they are there on the device they will
returned. If the desired font is not there an approximate match is returned. This
class is used to represent fonts and font metrics.
o
Fields
- public
static final int FONT_INPUT_TEXT
This field specifies a Font to be used to draw text input
by a user.
Value: 1.
- public
static final int FONT_STATIC_TEXT
This field specifies a default Font to be used to draw
Item and Screen contents.
Value: 0
o Methods
- public
static Font getFont(int fontSpecifier)
This method returns font that corresponds to the Font
passed in the argument.
public class Form
What is it?
The Form
contains an arbitrary mixture of items namely:
· Images
· Read-only
text fields
· Editable
text fields
· Editable
date fields
· Gauges
· Choice
groups
· Custom
items.
o Methods
This method deletes all the items from this Form leaving
it without any items.
This method returns the height of the displayable
area of the Form in pixels.
This method returns the width of the Form in
pixels.
public class Gauge
What is it?
This item
shows an integer value in a graphical display. Some devices implement it in
form of a bar graph while other show it as a progress screen.
o Fields
- public static final int CONTINUOUS_IDLE
This field represents the continuous
idle state of a non-interactive Gauge with an indefinite range.
- public static final int CONTINUOUS_RUNNING
This field represents the continuous
running state of a non-interactive Gauge with an indefinite range.
- public static final int INCREMENTAL_IDLE
This field represents the
incremental idle state of a non-interactive Gauge with indefinite range.
- public static final int INCREMENTAL_UPDATING
This field represents the
incremental updating state of a non-interactive Gauge with indefinite range.
- public static final int INDEFINITE
This field represents a special
value used for the maximum value in order to indicate that the Gauge has
indefinite range.
public class Graphics
What is it?
This class
acts as a pen/brush for drawing. It provides us with a simple 2D geometric
rendering capability.
o
Fields
- public static
final int BASELINE
This field is the constant for positioning the anchor
point at the baseline of text.
- public
static final int BOTTOM
This field is the constant for positioning the anchor
point of text and images below the text or mage.
- public
static final int DOTTED
This field is the constant for the DOTTED stroke style.
- public
static final int HCENTER
This field is the constant for centering text and images
horizontally around the anchor point.
- public
static final int LEFT
This field is the constant for positioning the anchor
point of text and images to the left of the text or image.
- public
static final int RIGHT
This field is the constant for positioning the anchor
point of text and images to the right of the text or image.
- public
static final int SOLID
This field is the constant for the solid stroke style.
- public
static final int TOP
This field is the constant for positioning the anchor
point of text and images above the text or image.
- public
static final int VCENTER
This field is the constant for centering images
vertically around the anchor point.
o Methods
- public
void copyArea(int x_src, int y_src, int width, int height, int
x_dest, int y_dest, int anchor)
This method copies the contents of a
rectangular area (given by first 4 co-ordinates) to a destination area whose
anchor point identified by the variable anchor is located at the variables
represented by ‘x_dest’ and ‘y_dest’.
- public
void drawRegion(Image src, int x_src, int y_src, int width, int
height, int transform, int x_dest, int y_dest, int anchor)
This method copies a region of the
specified source image to a location within the destination, possibly
transforming (rotating and reflecting) the image data using the chosen
transform function.
- public
void drawRGB(int[] rgbData, int offset, int scanlength, int x, int y,
int width, int height, boolean processAlpha)
This method renders a series of
device-independent color values in a specified region. The values are stored in
the integer array ‘rgbData’ in a format with 24 bits of RGB and an eight-bit
alpha value (0xAARRGGBB), with the first value stored at the specified offset.
- public
void fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3)
This method is used for drawing
filled rectangles. This method fills the specified triangle will the current
color. The lines connecting each pair of points are included in the filled
triangle.
- public
int getDisplayColor(int color)
This method returns the
corresponding color that will be displayed on the device’s screen (in 0x00RRGGBB
format). This method is useful as the programmer can determine the actual
drawing color that will be used due to the device constraints instead of the
color he/she has given as the current color.
public
class Image
What is it?
The Image
class is used to hold graphical image data. This class holds the data in
off-screen memory and it is not painted in the Display till an explicit call is
not made to display it either by low level user interface classes like Canvas
or high level user interface classes like the Form
o Methods
- public
static Image createImage(Image image, int x, int y, int width, int
height, int transform)
This method returns the
created image from the specified co-ordinate area of the source image and
suitably transforms it according to the transform parameter.
- public
static Image createImage(java.io.InputStream stream)
This method returns the
created image from the decoded data obtained from an InputStream.
- public
static Image createRGBImage(int[] rgb, int width, int height,
boolean processAlpha)
This method returns the
created image from a sequence of ARGB values.
- public
void getRGB(int[] rgbData, int offset, int scanlength, int x, int
y, int width, int height)
This method obtains ARGB pixel data
from the specified region of this image and stores it in the array of integers
provided in the method signature.
public class ImageItem
What is
it?
ImageItem
is an item that can contain an image.
o Constructors
- public
ImageItem(String label, Image image, int layout, String altText, int
appearanceMode)
Creates a new ImageItem object with the given label,
image, layout directive, alternate text string, and appearance mode. Either
label or alternative text may be present or null.
o Methods
- public
int getAppearanceMode()
This method returns the appearance mode value
which can be one of the following values: Item.PLAIN, Item.HYPERLINK or Item.BUTTON
public abstract class Item
What is
it?
This is
the super class for all the components that can be added to a Form
o
Field
- public
static final int BUTTON
A field which stands for an
appearance mode value indicating that the Item is to appear as a button.
- public
static final int HYPERLINK
A field which stands for an
appearance mode value indicating that the Item is to appear as a hyperlink.
- public
static final int LAYOUT_2
A field which stands for a layout
directive indicating that new MIDP 2.0 layout rules are in effect for this Item.
If this bit is clear it indicates that MIDP 1.0 layout behavior applies to this
Item.
- public
static final int LAYOUT_BOTTOM
A field which stands for a layout
directive indicating that this Item should have a bottom-aligned layout.
- public
static final int LAYOUT_CENTER
A field which stands for a layout
directive indicating that this Item should have a horizontally centered layout.
- public
static final int LAYOUT_DEFAULT
A field which stands for a layout
directive indicating that this Item should follow the default layout policy of
its container.
- public
static final int LAYOUT_EXPAND
A field which stands for a layout
directive indicating that this Item's width may be increased to fill available
space.
- public
static final int LAYOUT_LEFT
A field which stands for a layout
directive indicating that this Item should have a left-aligned layout.
- public
static final int
LAYOUT_NEWLINE_AFTER
A field which stands for a layout
directive indicating that this Item should the last on its line or row, and
that the next Item (in case there is any) in the container should be placed on
a new line or row.
- public
static final int
LAYOUT_NEWLINE_BEFORE
A field which stands for a layout
directive indicating that this Item should be placed at the beginning of a new
line or row.
- public
static final int LAYOUT_RIGHT
A field which stands for a layout
directive indicating that this Item should have a right aligned layout.
- public
static final int LAYOUT_SHRINK
A field which stands for a layout
directive indicating that this Item's width may be reduced to its minimum
width.
- public
static final int LAYOUT_TOP
A field which stands for a layout
directive indicating that this Item should have a top aligned layout.
- public
static final int LAYOUT_VCENTER
A field which stands for a layout
directive indicating that this Item should have a vertically centered layout.
- public
static final int LAYOUT_VEXPAND
A field which stands for a layout
directive indicating that this Item's height may be increased to fill available
space.
- public
static final int LAYOUT_VSHRINK
A field which stands for a layout
directive indicating that this Item's height may be reduced to its minimum
height.
- public
static final int PLAIN
This field indicates that the item
should have a normal appearance.
o Methods
·
public void addCommand(Command cmd)
This method adds a context sensitive Command to the item.
This method returns a combination of layout
directive values
- public
int getMinimumHeight()
This method returns the minimum height of this
item.
- public
int getMinimumWidth()
This method returns the minimum width of this item.
- public
int getPreferredHeight()
This method returns the preferred height of this Item.
- public
int getPreferredWidth()
This method returns the preferred width of this
Item.
- public
void notifyStateChanged()
This method causes this Item's containing Form to notify
the Item's ItemStateListener.
- public
void removeCommand(Command cmd)
This method removes the context sensitive command from this
item.
- public
void setDefaultCommand(Command cmd)
This method sets default Command for this Item.
- public
void setItemCommandListener(ItemCommandListener l)
This method sets a listener for Commands to this Item
replacing any previous ItemCommandListener.
- public
void setLayout(int layout)
This method sets the layout directives for this item.
- public
void setPreferredSize(int width, int height)
This method sets the preferred width and height for this Item.
public interface ItemCommandListener
What is
it?
This is a
new form of event listener which has been introduced in MIDP 2.0 for receiving
notification of commands that have been invoked on Item objects.
o Methods
·
public void commandAction(Command c,
Item item)
This method is called by the system to indicate that a
command has been invoked on a specific item.
public class List
What is
it?
List is a
Screen containing list of choices. This class gives us a very good user
interface element for situation where a user has to choose between different
choices or choose some elements among many. An example of an application where
a list can be particularly useful is a restaurant menu application where a user
can choose items to order for home delivery.
o Methods
- public
int getFitPolicy()
This method gets the application’s preferred policy for
fitting Choice element contents to the available screen space.
- public
Font getFont(int elementNum)
This method returns the preferred font to use to render
the specified element.
- public
void removeCommand(Command cmd)
This method overrides the removeCommand method in
Displayable.
- public
void setFitPolicy(int fitPolicy)
This method sets the application’s preferred policy for
fitting Choice element contents to the available screen space.
- public
void setFont(int elementNum, Font font)
This method sets the application’s preferred font for
rendering the specified element of this Choice.
- public
void setSelectCommand(Command command)
This method sets the Command to be used for an IMPLICIT
List selection action. This method will have no effect for other types of
Lists. Setting a null value is allowed. The command should be null only if you
want to have no select command for the List.
public
abstract class Screen
What is
it?
Screen is the common super class of all high-level user
interface classes. The contents that are displayed and their interaction with
the user are defined by subclasses of Screen. In MIDP 2.0 the 4 methods of
Screen that were there in MIDP 1.0 have been shifted to Displayable.
public
class Spacer
What is
it?
A Spacer
is a blank, non-interactive item that has a settable minimum size.
o Constructors
·
public Spacer(int minWidth, int minHeight)
This constructor creates a new Spacer with the given
minimum size.
o Methods
·
public void addCommand(Command cmd)
Spacers can not contain Commands. Therefore this method
will always throw IllegalStateException whenever it is called for a Spacer.
- public
void setDefaultCommand(Command cmd)
Spacers can not contain Commands. Therefore this method
will always throw IllegalStateException whenever it is called for a Spacer.
- public
void setLabel(String label)
Spacers can not contain labels. Therefore this method
will always throw IllegalStateException whenever it is called for a Spacer.
- public
void setMinimumSize(int minWidth, int minHeight)
This method sets the minimum size for this spacer. The Form
will not be allowed to make the Spacer smaller than this size. The minimum size
of Spacer must be zero or greater.
To do List
public class StringItem
What is
it?
StringItem
is an item that can contain a non – editable string. It contains a label and a
text element.
o Constructors
- public
StringItem(String label, String text, int appearanceMode)
This constructor is a new edition in MIDP 2.0. It creates
a new object with the given label, textual content and appearance mode. The label
or text elements may be present or they may have null value.
o Methods
·
public int getAppearanceMode()
This method returns the appearance mode value. The
value may be one of the following:
·
Item.PLAIN
·
Item.HYPERLINK
·
Item.BUTTON
This method returns the preferred font of the
application that will be used to render this StringItem
- public
void setFont(Font font)
This method sets the application’s preferred font for
rendering this StringItem.
public class TextBox
What is
it?
The TextBox class is a Screen that allows the
user to enter and edit text.
o Methods
- public
void setInitialInputMode(String characterSubset)
This method sets a hint to the implementation as to the
input mode that should be used when the user initiates editing of this TextBox.
What are Input Modes?
A string parameter is passed in the method setInitialInputMode(). This
parameter is used to name the Unicode character subset that is desired as an
input mode. This method gives a hint to the device about the application’s
desire for a particular input mode. This input mode is not necessary to be the
one that user sees on this device as there are a lot of variations in different
devices. Thus the device can only try to match the input mode. If it can not
find the match it will show the default input mode.
Unicode character blocks that can be used as the value for the parameter can
be named by adding the prefix “UCB_” to the string names of fields representing Unicode character blocks as defined in the
J2SE class java.lang.Character.UnicodeBlock. Unicode
character blocks may be named in this fashion. The
most common Unicode character blocks are as follows:
·
UCB_BASIC_LATIN
·
UCB_GREEK
·
UCB_CYRILLIC
·
UCB_ARMENIAN
·
UCB_HEBREW
·
UCB_ARABIC
·
UCB_DEVANAGARI
·
UCB_BENGALI
·
UCB_THAI
·
UCB_HIRAGANA
·
UCB_KATAKANA
·
UCB_HANGUL_SYLLABLES
You can also use the “Input subsets” as defined by the
J2SE class java.awt.im.InputSubset by adding the prefix “IS_” to the string
names of fields representing input subsets as defined in that class. The
following are the names of the currently defined input subsets:
·
IS_FULLWIDTH_DIGITS
·
IS_FULLWIDTH_LATIN
·
IS_HALFWIDTH_KATAKANA
·
IS_HANJA
·
IS_KANJI
·
IS_LATIN
·
IS_LATIN_DIGITS
·
IS_SIMPLIFIED_HANZI
·
IS_TRADITIONAL_HANZI
Mobile Information Device Profile has also defined the following character
subsets:
·
MIDP_UPPERCASE_LATIN – This
is the subset of IS_LATIN that corresponds to uppercase Latin letters.
·
MIDP_LOWERCASE_LATIN – This
is the subset of IS_LATIN that corresponds to lowercase Latin letters.
The device implementations may also have specific character subsets that
may be named with strings that have a prefix of “X_”.
public class TextField
What is
it?
A TextField is an editable
text component that may be placed into a Form.
o Fields
- public static final int DECIMAL
When you use this field the user is
allowed to enter numeric values with optional decimal fractions.
- public static final int INITIAL_CAPS_SENTENCE
This flag is a hint to the
implementation that during text editing of the contents of TextField the
initial letter of each sentence should be capitalized.
- public static final int INITIAL_CAPS_WORD
This flag is a hint to the implementation
that during text editing of the contents of TextField the initial letter of
each word should be capitalized.
- public static final int NON_PREDICTIVE
This field indicates that the text
entered by the user would not consist of words that are likely to be found in
dictionaries typically used by predictive input schemes.
- public static final int SENSITIVE
This field indicates that the text
entered is sensitive data. The device must never store into a dictionary or
table for use in predictive, auto-completing or other accelerated input
schemes. A security ID is an example of sensitive data.
- public static final int UNEDITABLE
This field indicates that editing is
currently disallowed. When this flag is set the device will prevent the user
from changing the text contents of this object.
o Methods
- public
void setInitialInputMode(String characterSubset)
This method sets a hint to the implementation as to
the input mode that should be used when the user initiates editing of this TextField.