Skip to main content

form.show() throws exception

2 replies [Last post]
Anonymous

Hi...

My application starts on a login form (formUserLogin). Upon successful
login, it goes to another form (formHome), which has a command to
logout. The logout registered command listener then simply calls
formUserLogin.show, but that give an exception in the output console
(System.out.println...), the formUserLogin is not displayed, and all
commands (including the logout) becomes unresponsive.

Here is the exception:
java.lang.StringIndexOutOfBoundsException: String index out of range: 3
at java.lang.String.substring(String.java:1935)
at
com.sun.lwuit.plaf.DefaultLookAndFeel.drawTextField(DefaultLookAndFeel.java:897)
at com.sun.lwuit.TextField.paint(TextField.java:709)
at com.sun.lwuit.Component.paintInternal(Component.java:567)
at com.sun.lwuit.Container.paint(Container.java:382)
at com.sun.lwuit.Component.paintInternal(Component.java:567)
at com.sun.lwuit.Container.paint(Container.java:382)
at com.sun.lwuit.Form.paint(Form.java:1354)
at com.sun.lwuit.Component.paintInternal(Component.java:567)
at com.sun.lwuit.Component.paintComponent(Component.java:656)
at com.sun.lwuit.Implementation.paintDirty(Implementation.java:381)
at com.sun.lwuit.Implementation.edtLoopImpl(Implementation.java:591)
at com.sun.lwuit.Implementation.mainEDTLoop(Implementation.java:547)
at com.sun.lwuit.Implementation.run(Implementation.java:508)

I don't know if I'm doing something wrong. Any help is greatly appreciated.
thanks,
Daniel.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Shai Almog

Hi Daniel,
this seems like a bug in the text field. I think it probably occurs
because you invoked setText("") or something like that after inputing
a larger string which moved the cursor location.
I will fix this behavior for the next drop, in the meantime as a
workaround you can try:
field.setText("");
field.setCursorPosition(0);

Thanks for bringing this to our attention.
Shai.

> Hi...
>
> My application starts on a login form (formUserLogin). Upon
> successful login, it goes to another form (formHome), which has a
> command to logout. The logout registered command listener then
> simply calls formUserLogin.show, but that give an exception in the
> output console (System.out.println...), the formUserLogin is not
> displayed, and all commands (including the logout) becomes
> unresponsive.
>
> Here is the exception:
> java.lang.StringIndexOutOfBoundsException: String index out of
> range: 3
> at java.lang.String.substring(String.java:1935)
> at com.sun.lwuit.plaf.DefaultLookAndFeel.drawTextField
> (DefaultLookAndFeel.java:897)
> at com.sun.lwuit.TextField.paint(TextField.java:709)
> at com.sun.lwuit.Component.paintInternal(Component.java:567)
> at com.sun.lwuit.Container.paint(Container.java:382)
> at com.sun.lwuit.Component.paintInternal(Component.java:567)
> at com.sun.lwuit.Container.paint(Container.java:382)
> at com.sun.lwuit.Form.paint(Form.java:1354)
> at com.sun.lwuit.Component.paintInternal(Component.java:567)
> at com.sun.lwuit.Component.paintComponent(Component.java:656)
> at com.sun.lwuit.Implementation.paintDirty
> (Implementation.java:381)
> at com.sun.lwuit.Implementation.edtLoopImpl
> (Implementation.java:591)
> at com.sun.lwuit.Implementation.mainEDTLoop
> (Implementation.java:547)
> at com.sun.lwuit.Implementation.run(Implementation.java:508)
>
> I don't know if I'm doing something wrong. Any help is greatly
> appreciated.
> thanks,
> Daniel.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Daniel H. Cavalcanti

Shai Almog wrote:
> Hi Daniel,
> this seems like a bug in the text field. I think it probably occurs
> because you invoked setText("") or something like that after inputing
> a larger string which moved the cursor location.
> I will fix this behavior for the next drop, in the meantime as a
> workaround you can try:
> field.setText("");
> field.setCursorPosition(0);
>
> Thanks for bringing this to our attention.
> Shai.
>
>> Hi...
>>
>> My application starts on a login form (formUserLogin). Upon
>> successful login, it goes to another form (formHome), which has a
>> command to logout. The logout registered command listener then simply
>> calls formUserLogin.show, but that give an exception in the output
>> console (System.out.println...), the formUserLogin is not displayed,
>> and all commands (including the logout) becomes unresponsive.
>>
>> Here is the exception:
>> java.lang.StringIndexOutOfBoundsException: String index out of range: 3
>> at java.lang.String.substring(String.java:1935)
>> at
>> com.sun.lwuit.plaf.DefaultLookAndFeel.drawTextField(DefaultLookAndFeel.java:897)
>>
>> at com.sun.lwuit.TextField.paint(TextField.java:709)
>> at com.sun.lwuit.Component.paintInternal(Component.java:567)
>> at com.sun.lwuit.Container.paint(Container.java:382)
>> at com.sun.lwuit.Component.paintInternal(Component.java:567)
>> at com.sun.lwuit.Container.paint(Container.java:382)
>> at com.sun.lwuit.Form.paint(Form.java:1354)
>> at com.sun.lwuit.Component.paintInternal(Component.java:567)
>> at com.sun.lwuit.Component.paintComponent(Component.java:656)
>> at
>> com.sun.lwuit.Implementation.paintDirty(Implementation.java:381)
>> at
>> com.sun.lwuit.Implementation.edtLoopImpl(Implementation.java:591)
>> at
>> com.sun.lwuit.Implementation.mainEDTLoop(Implementation.java:547)
>> at com.sun.lwuit.Implementation.run(Implementation.java:508)
>>
>> I don't know if I'm doing something wrong. Any help is greatly
>> appreciated.
>> thanks,
>> Daniel.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
>> For additional commands, e-mail: users-help@lwuit.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
Ok. I'll try that. Thanks,
By the way. I love this new toolkit. It's very cool and make developing
J2ME really easy. Great job.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net