1   package wbKerho;
2   
3   import java.awt.BorderLayout;
4   import java.awt.FlowLayout;
5   import java.awt.Frame;
6   import java.awt.event.ActionEvent;
7   import java.awt.event.ActionListener;
8   
9   import javax.swing.JButton;
10  import javax.swing.JDialog;
11  import javax.swing.JPanel;
12  import javax.swing.WindowConstants;
13  import javax.swing.border.EmptyBorder;
14  
15  /**
16   * Dialogi, joka näyttää ohjelman tiedot
17   * @author vesal
18   * @version 5.1.2011
19   *
20   */
21  public class TiedotDialog extends JDialog {
22  
23      private static final long serialVersionUID = 1L;
24  
25      private final JPanel contentPanel = new JPanel();
26      private final JPanel buttonPane = new JPanel();
27      private final JButton okButton = new JButton("OK");
28      private final TiedotPanel tiedotPanel = new TiedotPanel();
29  
30      
31     
32  
33      /**
34       * Create the dialog.
35       */
36      public TiedotDialog() {
37          super((Frame)null,"Tietoja",false);
38          setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
39          setBounds(100, 100, 450, 300);
40          getContentPane().setLayout(new BorderLayout());
41          contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
42          getContentPane().add(contentPanel, BorderLayout.CENTER);
43          contentPanel.setLayout(new BorderLayout(0, 0));
44  
45          contentPanel.add(tiedotPanel);
46  
47          buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
48          getContentPane().add(buttonPane, BorderLayout.SOUTH);
49          okButton.addActionListener(new ActionListener() {
50              @Override
51              public void actionPerformed(ActionEvent arg0) {
52                  dispose();
53              }
54          });
55  
56          okButton.setActionCommand("OK");
57          buttonPane.add(okButton);
58          getRootPane().setDefaultButton(okButton);
59          setVisible(true);
60      }
61  
62  }
63