StartGUI.java
1
package cdcCheck;
2
3
import java.awt.GridLayout;
4
import javax.swing.BorderFactory;
5
import javax.swing.JButton;
6
import javax.swing.JCheckBox;
7
import javax.swing.JComboBox;
8
import javax.swing.JFrame;
9
import javax.swing.JLabel;
10
import javax.swing.JPanel;
11
12
public class StartGUI extends JFrame {
13
14
    public static void main(String args[]) {
15
        StartGUI gui = new StartGUI();
16
        gui.build();
17
    }
18
19
    public void build() {
20
        JPanel contentPane = (JPanel) this.getContentPane();
21
        contentPane.setLayout(new GridLayout(0, 1, 0, 5));
22
        contentPane.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
23
24
        JLabel label1 = new JLabel("Database to Check", JLabel.LEFT);
25
26
        JComboBox<String> database = new JComboBox<>(new String[]{"QA1", "Collector Lux", "Collector China"});
27
28
        JCheckBox checkBox = new JCheckBox("From existing selects.txt");
29
30
        JButton startButton = new JButton("Start");
31
        startButton.addActionListener(e -> {
32
            this.dispose();
33
            Main main;
34
            String db = (String) database.getSelectedItem();
35
            main = new Main(db, checkBox.isSelected());
36
            if (checkBox.isSelected()) {
37
                main.runSelects();
38
            } else {
39
                main.createSelects();
40
            }
41
        });
42
43
        contentPane.add(label1, JPanel.LEFT_ALIGNMENT);
44
        contentPane.add(database);
45
        contentPane.add(checkBox);
46
        contentPane.add(startButton);
47
48
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
49
        this.setResizable(false);
50
        this.pack();
51
        this.setLocationRelativeTo(null);
52
        this.setVisible(true);
53
    }
54
}
Loading...