Solved

J2ME problems with textbox

Posted on 2003-11-06
3
346 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

771 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

10 Experts available now in Live!

Get 1:1 Help Now