Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

J2ME problems with textbox

Posted on 2003-11-06
3
Medium Priority
?
394 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
jimmack earned 240 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

618 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