The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
January 2002



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


It does not work

Posted by Micah Voiers on January 30, 2002 at 12:30 PM

Actually the reason it does not work is that you are in running in one thread and while you are in action perform the gui will not perform an update on the screen. And so when you set the text to "Working..." and then go on to perform the calculation no screen update is performed until you leave that method. The reason working is displayed when you enter a non numerical value is that "Working" is set in the text display and then an exception cause an exit from the action performed method. Now when update is called the text field is redrawn with working.

I'm not to familiar with GUI but you need to force a repaint or update after setText field is called. Other wise it is set to "Working" then to the result before the screen is updated.

> Hi
> Your applet works as fine. If you enter a small number then the time taken between the display of "Working..." and the actual result is so small that you cannot see the text "Working...". But it is displayed. If you enter a big number and then hit enter then text "Working...." is displayed. If you enter a text , say "abc", which is not a number then also it displays "Working..." for ever because Interger.parseInt() throws exception.

> Thanks
> Kishori


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us