Solved

J2ME problems with textbox

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet filter example 37 83
Html Table Looping (part 2) 5 35
Netbeans and org.apache.commons.lang3 issue 3 26
Java List 4 41
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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 tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

733 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