Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in setting text to jlabel while another action is going on.

 
SaiManasa Dasari
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have jframe which is having two panels.first panel the textbox and button is there and in second panel jabel is there.when i am updating text in the textbox jlabel text should be "updating....." .After completion of update operation jlabel text should be "updated successfully".But while update is ggoing on the text which i have set to jlabel is not appearing in jlabel.After completion of update operation it is showing text "updated successfully".

button.addActionListener(this);
public void actionPerformed(ActionEvent ae)
{
String command = ae.getActionCommand();
if(command.equals("Update"))
{
showStatus.setText("updating.....");
boolean result=handleupdate();
if(rresult)
{
showStatus.setText("updated successfully..");
}
else
{
showStatus.setText("updation failed...");
}
}
}




Please help me to resove this.Thanks in advance
 
Campbell Ritchie
Sheriff
Pie
Posts: 47293
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a threading problem. You know that all use of Swing components must be in the Event Despatch Thread? If you have another action going on which is time‑consuming, you might do well to start another thread. Look for the SwingWorker class as one way to do that.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47293
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But do you want it to say “updated” before the update is completed? Look up progress bars.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic