Re: ItemStateListener
- From: Roedy Green <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx>
- Date: Wed, 29 Mar 2006 17:53:34 GMT
On Wed, 29 Mar 2006 17:44:26 +0200, "Anoniem" <geheim> wrote, quoted
or indirectly quoted someone who said :
I have formatted your program so that it is more comprehensible:
import java.util.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class CDF extends MIDlet implements ItemStateListener
{
private Display display;
private Form fmMain;
private DateField dfTime;
public CDF()
{
display = Display.getDisplay(this);
// The main form
fmMain = new Form("Testing..");
// DateField with todays date as a default
dfTime = new DateField("", DateField.DATE_TIME);
dfTime.setDate(new Date());
// Add to form and listen for events
fmMain.append(dfTime);
fmMain.setItemStateListener(this);
}
public void startApp ()
{
display.setCurrent(fmMain);
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
public void itemStateChanged(Item item)
{
System.out.println("itemStateChanged");
}
}
If this were an AWT program I would say
fmMain.setItemStateListener(this);
should read
fmMain.addtemStateListener(this);
But since it is a MIDLET, I don't know.
I would also check that if you are supported to an get an Item rather
than an event at your listener. That is not how AWT works.
I would check that Forms generate ItemStateChanged events not some
other sort. That is the usual problem in AWT.
Sorry I can't be more help since I don't have midlet experience.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
.
- References:
- ItemStateListener
- From: Anoniem
- ItemStateListener
- Prev by Date: Re: Javadoc search tool ... is this new ???
- Next by Date: Re: Good way to remove Vector elements from end?
- Previous by thread: ItemStateListener
- Next by thread: Re: ItemStateListener
- Index(es):
Relevant Pages
|
|