wood burning stoves 2.0*
The moose likes Java Micro Edition and the fly likes Doubt from John W.Muchow -core J2ME Technology &MIDP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Doubt from John W.Muchow -core J2ME Technology &MIDP" Watch "Doubt from John W.Muchow -core J2ME Technology &MIDP" New topic
Author

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

Meena kumar
Greenhorn

Joined: Dec 13, 2006
Posts: 3
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

Joined: Jan 25, 2007
Posts: 226
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..

---------------------


Theepan Thevathasan
SCJP 1.4, SCWCD 1.4, SCMAD 1.0 SCBCD 1.3, MCP(.Net Frm 2.0 App Dev Fdn)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt from John W.Muchow -core J2ME Technology &MIDP