J
James Kimble
I'm using a JLabel to indicate the status of a program I'm running in
another thread. The problem is that I want to do a "label.setText" to
"Please wait", let the other thread run (the call waits until it
returns), then use "label.setText" to display the result. The problem
is the "Please wait" is never seen. The result is displayed but no
matter what I do the label stays in it's initial state, telling the
user to "Press the run button", until the called program completes and
then the results are displayed. No "Please wait" in between. It's
making me nuts!! What the heck is going on!
The code is below:
There are a set of selection buttons that initially set label l3 as
in:
l3.setText ("Press Run Check to continue");
Then the run button trys to set it to Please Wait util the results
are displayed:
JButton b4 = new JButton ("Run Check");
b4.setBounds(60, 225, BTN_WD, BTN_HT);
b4.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
strResult[0] = "10";
l3.setText ( "Please wait....." );
strResult = Utils.execCmdAndWait(command,true);
log.info ( "Integrit returned result: " + strResult[0]
);
if ( result.equals("1") )
{
l3.setText ( "RESULT: Possible file corruption!" );
}
else
{
l3.setText ( "RESULT: Files verified good!" );
}
}
});
Only the initial state and RESULT is displayed. The call to CmdAndWait
can take several minutes. During that time the label stays in it's
initial state until the call returns when the label changes to the
RESULT: text.
Any help here greatly appreciated. I think it's a swing update thing
but calling repaint() doesn't help either. AHHHHHHHHHHHHHHHHHHH!!
another thread. The problem is that I want to do a "label.setText" to
"Please wait", let the other thread run (the call waits until it
returns), then use "label.setText" to display the result. The problem
is the "Please wait" is never seen. The result is displayed but no
matter what I do the label stays in it's initial state, telling the
user to "Press the run button", until the called program completes and
then the results are displayed. No "Please wait" in between. It's
making me nuts!! What the heck is going on!
The code is below:
There are a set of selection buttons that initially set label l3 as
in:
l3.setText ("Press Run Check to continue");
Then the run button trys to set it to Please Wait util the results
are displayed:
JButton b4 = new JButton ("Run Check");
b4.setBounds(60, 225, BTN_WD, BTN_HT);
b4.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
strResult[0] = "10";
l3.setText ( "Please wait....." );
strResult = Utils.execCmdAndWait(command,true);
log.info ( "Integrit returned result: " + strResult[0]
);
if ( result.equals("1") )
{
l3.setText ( "RESULT: Possible file corruption!" );
}
else
{
l3.setText ( "RESULT: Files verified good!" );
}
}
});
Only the initial state and RESULT is displayed. The call to CmdAndWait
can take several minutes. During that time the label stays in it's
initial state until the call returns when the label changes to the
RESULT: text.
Any help here greatly appreciated. I think it's a swing update thing
but calling repaint() doesn't help either. AHHHHHHHHHHHHHHHHHHH!!