• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Doubt from John W.Muchow -core J2ME Technology &MIDP

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Help me in this program. This program compiles fine but when I run in WTK22 simulator it's erroring out as

Running with storage root DefaultColorPhone
Cannot connect socket to port 2302
Windows error code 10022
Cannot open socket for LIME events on port 2302

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class CaptureItemEvents extends MIDlet implements ItemStateListener,CommandListener
{
private Display display;
private Form fmMain;
private Command cmExit;
private DateField dfDate;

public CaptureItemEvents()
{
display=Display.getDisplay(this);

dfDate=new DateField("Date is:",DateField.DATE);
dfDate.setDate(new java.util.Date());

cmExit=new Command("Exit",Command.EXIT,1);
fmMain=new Form("core J2ME");
fmMain.addCommand(cmExit);
fmMain.append(dfDate);

fmMain.setCommandListener(this);
fmMain.setItemStateListener(this);
}

public void startApp()
{
display.setCurrent(fmMain);
}

public void pauseApp()
{}
public void destroyApp(boolean unconditional){}
public void commandAction(Command c,Displayable s)
{
if(c==cmExit)
{
destroyApp(false);
notifyDestroyed();
}
}
public void itemStateChanged(Item item){
dfDate.setLabel("New Date:");
}
}
 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi buddy,
your code was working fine on the emulator that was provided with NetBeans 5.5

AS far as i know void itemStateChanged() works for only Items on a Form...

Though you are listening all the item state changes on the main form, lack of Item Classes will not stimulate a setLabel() on the DateField..

Please confirm my ideas on ItemStateListener interface's callback..

---------------------
 
reply
    Bookmark Topic Watch Topic
  • New Topic