Solved

J2ME problems with textbox

Posted on 2003-11-06
3
390 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 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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 …

707 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