Solved

J2ME problems with textbox

Posted on 2003-11-06
3
360 Views
Last Modified: 2007-12-19
Started learning java micro edition, so Im still a bit of a newbie, but Ive come across a problem when i try to use a textbox more than once.

Using (as an example) guitests.java available at
http://wireless.java.sun.com/midp/articles/ui/      (html version) and
http://wireless.java.sun.com/midp/articles/ui/GuiTests.java   (java code)

I can go to the textbox form, hit back, go there again and i get this thrown at me:

java.lang.IllegalStateException
      at javax.microedition.lcdui.Form.append(+20)
      at one.SendTo(+24)
      at one.commandAction(+383)
      at javax.microedition.lcdui.List.callKeyPressed(+74)
      at javax.microedition.lcdui.Display$DisplayAccessor.keyEvent(+202)
      at javax.microedition.lcdui.Display$DisplayManagerImpl.keyEvent(+11)
      at com.sun.midp.lcdui.DefaultEventHandler.keyEvent(+124)
      at com.sun.midp.lcdui.AutomatedEventHandler.keyEvent(+210)
      at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+178)

Ive semi managed to work around it by putting in a form.delete(0) and form.deleteAll(), but its still buggy. Is there a way to make textboxs work?
0
Comment
Question by:hippydaz
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
jimmack earned 80 total points
ID: 9693545
The problem isn't with the TextBox itself.  You are attempting to add it to a from (using append), when the form already has the text box in it.

You seem to have realised this because you are using form.delete... to remove it.  Have a look in your SendTo method to see if you really need to add the text box each time.  Perhaps you could just change (or clear) the contents.
0
 

Author Comment

by:hippydaz
ID: 9700168
Okay, this is just weird.

I already kinda knew that, was wondering how to actually do it.

So i check the guitests.java , and theyve updated it. (mustve been in the last day or so) so it doesnt crash anymore.

I can get around it by adding the textfield to the form at the startup method and then just showing the form whenever i need.

Oh well....points to jimmack anyway, seeing as he did his best to help me.

Ta.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9700211
Thanx

;-)

If you need more help, I hang around both here (Java) and also in the Wireless Programming area - that's not as busy though ;-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Passing list of object to Oracle Database Procedure 3 60
groupSumClump challenge 9 102
why cannot we forward request once the response is committed 2 33
arguments to jar 5 15
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now