StringItem sample program in J2ME

By: Kamini Emailed: 1745 times Printed: 2434 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

The StringItem class defines a two-part display component. StringItem objects contain a label and some immutable text. The sample J2ME program shows the pertinent parts of the StringItemDemo code. You can correlate the text in the constructor's two argument parameters with the text on the display. This is a very simple UI component.

StringItem objects give you a convenient way to associate a label with a value. You can put a String in a Form instead of using a StringItem object, but the StringItem has the advantage that its implementation ensures that the label and value strings remain together on the display.

 

 

String items are forms.
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;
/**
This class demonstrates use of the StringItem MIDP UI
class.
@see javax.microedition.lcdui.StringItem
*/
public class StringItemDemo extends Form
 

implements CommandListener
{
private Command back =
new Command("Back", Command.BACK, 1);
private static Displayable instance;
private StringItem si =
new StringItem("StringItem's title",
"Immutable item text");
/**
Constructor.
*/
public StringItemDemo()
{
super("StringItem Demo");
append(si);
addCommand(back);
setCommandListener(this);
instance = this;
}
...
}

 


J2ME Home | All J2ME Tutorials | Latest J2ME Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Kamini
Importing the Certificate Reply from the CA example using keytool in Java
The switch Statement example in Java
Joins example in SQL
ERRNO.H Header File in C
XDoclet struts-config.xml in Struts
Macro Substitution using #define in C
Using Checkbox & Radio Tags, html:select, html:options in Struts Forms
Do while Loops in C
Functions in C
Opening files for read and write in C++
Operator Precedence in C++
StringItem sample program in J2ME
AWT-based applications with a User Interface Window in Java
store() and load() example in Java
Stray or Dangling Pointers in C++

More Tutorials in J2ME
Code sample to Send SMS from a J2ME application.
Adding your own Application icon for your J2ME application (jar file)
Play a multimedia file in J2ME Program (Audio/Video) using MMAPI
Datagrams in J2ME (UDP Programming sample)
Client Server in J2ME (Socket Programming sample)
Using HttpConnection in J2ME (Retrieve web content from a website to a phone)
Using HTTP vs UDP vs Socket in J2ME
RMSCookieConnector - Using Cookies in J2ME
POST UTF-8 encoded data to the server in J2ME
lists, forms, choices, gauges, text fields, text boxes in J2ME
Using List to create a Menu and Menu items in J2ME
Using alerts and tickers in J2ME
J2ME Canvas sample to show games programming in J2ME
Timer and TimerTask example in J2ME
List of GPRS Access points for all countries

More Latest News
Most Viewed Articles (in J2ME )
What is J2ME?
Ticker sample program in J2ME
'LINK.EXE' is not recognized as an internal or ext
List of GPRS Access points for all countries
Using List to create a Menu and Menu items in J2ME
Using HttpConnection in J2ME (Retrieve web content from a website to a phone)
Adding your own Application icon for your J2ME application (jar file)
RMS Basics in J2ME
Types of Profiles in J2ME
What is J2ME?
Download a file over a network in J2ME midlet
Sample Java program shows how to Read a file over a network using J2ME midlet
GUI components and menu based J2ME Applications.
How to get the CLDC and MIDP version from a J2ME program
Gauge sample program in J2ME
Most Emailed Articles (in J2ME)
What is J2ME?
Download a file over a network in J2ME midlet
Sample Java program shows how to Read a file over a network using J2ME midlet
Types of Profiles in J2ME
DateField sample program in J2ME
Ticker sample program in J2ME
Sample program to draw a arc in J2ME
The MIDP Networking Model in J2ME
Using alerts and tickers in J2ME
Play a multimedia file in J2ME Program (Audio/Video) using MMAPI
Adding your own Application icon for your J2ME application (jar file)
Y.S. Sun Green Building Research Center
'LINK.EXE' is not recognized as an internal or ext
A sample J2ME midlet that shows an example of using a Timer and a TimerTask.
How to get the CLDC and MIDP version from a J2ME program