i got until here..
public class ButtonListener implements ActionListener {
public void actionPerformed(ActionEvent buttonEvent) {
int delay = 1000; //milliseconds
ActionListener taskPerformer = new ActionListener(){
public void actionPerformed(ActionEvent evt)
{
JFrame myFrame1 = new JFrame();
MySadFace sad = new MySadFace();
myFrame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame1.getContentPane().add(sad);
myFrame1.setSize(400, 200);
myFrame1.setVisible(true);
}
};
Timer test = new Timer(1000, taskPerformer);
test.start();
//wait 10 seconds before going on.
try {
Thread.sleep(10000);
}
catch (Exception e) {}
test.stop();
int answer = JOptionPane.YES_OPTION;
answer = JOptionPane.showConfirmDialog(null, "BOOOoooM!!! Would you like to play again?", "", JOptionPane.YES_NO_OPTION);
the timer is working, but why doesn't the MySadFace work?
thanks