Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Meena kumar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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:");
}
}
 
Deepan Devadasan
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • 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..

---------------------
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic