There must be a delay between the setting of "Processing" and "Processed" JLabel
text otherwise the change in text will be too quick to observe.
One way to do this is to use a Swing Timer between the 2 setText
calls. Your JButton
ActionListener
could look like this:
public void actionPerformed(ActionEvent e) {
label.setText("Processing...");
ActionListener taskPerformer = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
label.setText("Processed");
}
};
Timer timer = new Timer(1000, taskPerformer); // delay one sec
timer.setRepeats(false);
timer.start();
}