View Javadoc

1   /*
2    * A JDialog containing the JPanel corresponding on the mousecliked zone
3    * 
4    */
5   package org.lsst.ccs.utilities.zonesui;
6   
7   import javax.swing.JButton;
8   import javax.swing.JDialog;
9   import javax.swing.JFrame;
10  import javax.swing.JPanel;
11  import java.awt.BorderLayout;
12  import java.awt.Window;
13  import java.awt.event.ActionEvent;
14  import java.awt.event.ActionListener;
15   
16   public class ClickDialog extends JDialog {
17  
18    private JButton bQuit = new JButton("Quit");
19       
20    public ClickDialog(Window parent, String title, boolean modal, JPanel jp){
21      super((JFrame)parent, title, modal);
22  
23      JPanel pbouton = new JPanel();
24      pbouton.add(bQuit);
25      bQuit.addActionListener(new ActionListener() {
26          @Override
27          public void actionPerformed(ActionEvent e) {
28              dispose();
29          }
30      });
31      this.getContentPane().setLayout(new BorderLayout());
32      this.getContentPane().add(jp,BorderLayout.CENTER);
33      this.getContentPane().add(pbouton,BorderLayout.SOUTH); 
34      this.setResizable(false); 
35      this.pack();
36      this.setVisible(true);
37    }
38   }
39