Re: ItemStateListener



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.
.



Relevant Pages

  • JSplitPane and another issue
    ... public class MainPanel extends JPanel implements ActionListener { ... private WebBrowserPane browserPane; ... public void actionPerformed{ ... // Display the window. ...
    (comp.lang.java.gui)
  • JSplit Pane and another issue
    ... public class MainPanel extends JPanel implements ActionListener { ... private WebBrowserPane browserPane; ... public void actionPerformed{ ... // Display the window. ...
    (comp.lang.java.gui)
  • Re: Can you get any more performance out of this?
    ... the way you use threads and arrange for stuff to happen on the AWT ... Document already has an AsynchronousLoadPriority that will cause setPage() to ... private ActionListener searchAction ...
    (comp.lang.java.programmer)
  • Repaint and Delay Problem
    ... I wrote the following short test applet to try to solve a problem but ... then display a blue letter 'B'. ... red letter 'A' should appear before the delay. ... public void update { ...
    (comp.lang.java.help)
  • Need Help converting int -> char -> string & TextArea display(!)
    ... display its contents character-by-character ... Please can someone show me how to read each character ... private TextArea inputTextArea; ... public void actionPerformed ...
    (comp.lang.java.help)