Source code (There's many files, can't paste them all here)
I am making a quick test game, and am making new commands. One of my commands, "clear", is supposed to be a bit fancy by first making the text dimmer, waiting for awhile, and then clearing it.
My Thread.sleep(1000), which I'm using for the "waiting", seems to prevent me from seeing the text go dimmer. I just immediately hang for a second, and the text disappears. Is there something wrong with my approach?
import java.awt.event.*;
public class Listener implements ActionListener {
Primaire runtime;
Listener(Primaire gRuntime) { runtime = gRuntime; }
public void actionPerformed(ActionEvent e) {
if (e.getSource() == runtime.input) {
String command = runtime.input.getText().toLowerCase();
if (command.equals("look"))
{ runtime.say(runtime.moniteur.surroundings); }
else if (command.equals("repeat"))
{ runtime.say(runtime.moniteur.levelInfo); }
else if (command.equals("clear")) {
try {
runtime.input.setText("");
runtime.output.setForeground(new java.awt.Color(80, 80, 80));
Thread.sleep(1000);
runtime.output.setText("");
runtime.output.setForeground(new java.awt.Color(160, 160, 160));
}
catch (InterruptedException ez) { }
}
else if (command.equals("")) {
}
else if (command.equals("")) {
}
runtime.input.setText("");
runtime.input.requestFocus();
}
}
}