Kin Wong
September 27th, 1999, 08:28 AM
Hi,
I'm using a JLabel at the bottom of my application as a status bar where I'm trying to inform the user that a certain operation is taking place, such as loading a file, etc. An excerpt of the inner class code is shown below. The problem I'm running into is that the setText is not updating statusLabel (even though the print statement clearly shows that I am setting the JLabel) until the process is completed. Any ideas why? I don't want to run the process under a seperate thread because I dont' want the user to continue until the process is completed correctly.
public class AppJFrame extends JFrame {
JLabel statusLabel = new JLabel(" ");
....
class ButtonActionListener implements ActionListener {
public void actionPerformed(ActionEvent event) {
statusLabel.setText("Loading Info ... ");
System.out.println("Status Bar Text = " + statusLabel.getText());
AppJFrame.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
// create a process that runs a C program. The println shows that
// statusLabel = "Loading Info ... ", but the JLabel is not updated
// until the process completes.
}
}
}
Thanks for any info,
Kin Wong
I'm using a JLabel at the bottom of my application as a status bar where I'm trying to inform the user that a certain operation is taking place, such as loading a file, etc. An excerpt of the inner class code is shown below. The problem I'm running into is that the setText is not updating statusLabel (even though the print statement clearly shows that I am setting the JLabel) until the process is completed. Any ideas why? I don't want to run the process under a seperate thread because I dont' want the user to continue until the process is completed correctly.
public class AppJFrame extends JFrame {
JLabel statusLabel = new JLabel(" ");
....
class ButtonActionListener implements ActionListener {
public void actionPerformed(ActionEvent event) {
statusLabel.setText("Loading Info ... ");
System.out.println("Status Bar Text = " + statusLabel.getText());
AppJFrame.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
// create a process that runs a C program. The println shows that
// statusLabel = "Loading Info ... ", but the JLabel is not updated
// until the process completes.
}
}
}
Thanks for any info,
Kin Wong