OSDN Git Service

MOD: enum is researved word. It was changed to mailList.
[mdc/BetaProject.git] / src / org / jent / checksmtp / ToListDialog.java
1 package org.jent.checksmtp;
2
3 import java.awt.Dimension;
4 import java.awt.Frame;
5 import java.awt.Rectangle;
6 import java.awt.event.ActionEvent;
7 import java.awt.event.ActionListener;
8 import java.awt.event.WindowEvent;
9
10 import java.util.ArrayList;
11
12 import javax.swing.JButton;
13 import javax.swing.JDialog;
14 import javax.swing.JList;
15 import javax.swing.JScrollPane;
16
17
18 public class ToListDialog extends JDialog {
19   private JButton jButton1 = new JButton();
20   private JButton jButton2 = new JButton();
21   private JList jList1 = new JList();
22   private JScrollPane scrollPane = new JScrollPane(); //add
23   private ArrayList toList = null;
24   private Processer processer = null;
25
26   public ToListDialog() {
27       this(null, "", false);
28   }
29
30   public ToListDialog(Frame parent, String title, boolean modal) {
31       super(parent, title, modal);
32
33       try {
34           jbInit();
35       } catch (Exception e) {
36           e.printStackTrace();
37       }
38   }
39
40   public ToListDialog(Processer processer, ArrayList toList) {
41       this(null, "TO Check", false);
42       this.toList = toList;
43       this.processer = processer;
44
45       if (toList != null) {
46           jList1.setListData(toList.toArray());
47
48           //jList1.update();
49           jList1.setVisible(true);
50       }
51
52       this.show();
53   }
54
55   private void jbInit() throws Exception {
56     jButton2.addActionListener(new ActionListener() {
57       public void actionPerformed(ActionEvent e) {
58         jButton2_actionPerformed(e);
59       }
60     });
61     this.setSize(new Dimension(584, 300));
62     this.getContentPane().setLayout(null);
63     this.setTitle("Conform Mail Destination");
64     this.addWindowListener(new java.awt.event.WindowAdapter() {
65       public void windowClosing(WindowEvent e) {
66         this_windowClosing(e);
67       }
68     });
69     jButton1.setText("OK");
70     jButton1.setBounds(new Rectangle(100, 240, 140, 25));
71     jButton1.addActionListener(new ActionListener() {
72       public void actionPerformed(ActionEvent e) {
73         jButton1_actionPerformed(e);
74       }
75     });
76     jButton2.setText("CANCEL");
77     jButton2.setBounds(new Rectangle(325, 240, 145, 25));
78     jList1.setBounds(new Rectangle(25, 25, 455, 200));
79     jList1.setSize(new Dimension(500, 200));
80     jList1.setToolTipText("null");
81     jList1.setValueIsAdjusting(true);
82     scrollPane.setBounds(new Rectangle(10, 5, 555, 225));
83     scrollPane.getViewport().setView(jList1); //add
84
85     //this.getContentPane().add(jList1, null);
86     this.getContentPane().add(scrollPane, null);
87     this.getContentPane().add(jButton2, null);
88     this.getContentPane().add(jButton1, null);
89   }
90
91   private void jButton1_actionPerformed(ActionEvent e) {
92     //push OK
93     processer.sayOK();
94     this.dispose();
95   }
96
97   private void jButton2_actionPerformed(ActionEvent e) {
98     processer.sayNG();
99     this.dispose();
100   }
101
102   private void this_windowClosing(WindowEvent e) {
103     processer.sayNG();
104   }
105 }