Hi.
I have created a modal dialog box thus:
JDialog dialog = new JDialog(); dialog.setModal(true); dialog.setSize(400, 150); dialog.setTitle("Input dialog"); Container pane = dialog.getContentPane(); pane.setLayout(null); JLabel l1 = new JLabel("simtime(min)"); pane.add(l1); l1.setBounds(10, 10, 100, 10); JTextField tf = new JTextField(""); pane.add( tf); tf.setBounds(110,10, 40, 15); JLabel l2 = new JLabel("interval(sec)") ; pane.add(l2); l2.setBounds(10, 50, 100, 10); JTextField tf2 = new JTextField(""); pane.add( tf2); tf2.setBounds(110,50, 40, 15); dialog.setVisible(true); JButton button = new JButton("OK"); pane.add(button); button.setBounds(120,120,40,20); int simTime = Integer.parseInt( tf.getText() );; int interval = Integer.parseInt( tf2.getText() );
But nothing happens when I click on the "OK" button. Why?and what should I do?
Thanks in advance