JFrame "reshowing"
Hi,
I have a problem with Frame refreshing or rather "reshowing".
I know that there are similar topics but in none of them I found
solution.
I need to make a window which simply appears and disappears
in certain time intervals. The problem is that when it appears
for the >=second time it is nothing but a grey rectangle.
So which methods do I have to use?
class NotifyFrameextends JFrame{
public NotifyFrame(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("Notifying");
setPreferredSize(new Dimension(300, 150));
pack();
setVisible(true);
final JFrame frame =this;
new Timer(3000,new ActionListener(){
publicvoid actionPerformed(ActionEvent e){
validate();
repaint();
setVisible(true);
try{
Thread.sleep(1000);
}catch(Exception ex){
ex.printStackTrace();
}
setVisible(false);
}
}).start();
}
}

