no see actually my code is like this....
where i have a JOprionPane inside in JDialog... and i use timer concept
so that if the user is not clicking the OK button then it should automatically go off
so i need the code for on OK button see this is code..
code:
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class timy extends JFrame {
timy t;
JOptionPane jp;
JDialog jd;
public timy()
{
t = this;
System.out.println("this is the OVER(f)");
jd =new JDialog(t, "there is something wrong in the stations",false);
jd.setAlwaysOnTop(true);
jd.setBounds(50, 50, 500, 100);
JLabel jl = new JLabel("there is something wrong in the stations");
JOptionPane jp1 = new JOptionPane();
jd.add(jl);
jd.add(jp1);
jd.show();
java.util.Timer timer = new java.util.Timer();
java.util.TimerTask task = new java.util.TimerTask() {
public void run() {
jd.dispose();
}
};
timer.schedule(task,1000);
}
public void cal()
{
this.show();
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setResizable(false);
this.setSize(400, 400);
this.setVisible(true);
}
public static void main(
String[] args) {
timyt = new timy();
t.cal();
}
}