Hi,
I have a simple JFrame program, I have a JButton and JLabel, JLabel is initialize with some value. on button click I want to execute one process which will take more than 3 seconds, before process starts and ends i want to show process status in JLabel. but it always sets last value assigned to label when process gets executed.
public void actionPerformed(ActionEvent event)
{
String actionCommand = event.getActionCommand();
if(actionCommand.equals("Click Me"))
{
jlbl.setText("Process start");
someMethod();
jlbl.setText("Process end");
}
}
private void someMethod()
{
try
{
Thread.sleep(3000);
}
catch (InterruptedException e)
{
System.out.println(e.getMessage());
}
}
Thanks,
harshal