public FlagOptions() { // Initialize super(); this.setMinimumSize(new Dimension(200, 100)); // Get the AML instance aml = AML.getInstance(); // And the lists of match steps & match configurations selectedSteps = aml.getFlagSteps(); flaggers = new Vector<JCheckBox>(); for (Problem m : Problem.values()) { JCheckBox cb = new JCheckBox(m.toString()); cb.setSelected(selectedSteps.contains(m)); flaggers.add(cb); } // Set the title and modality this.setTitle("Flagging Options"); this.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); // Match Steps JPanel subPanel = new JPanel(); JPanel flaggerPanel = new JPanel(); flaggerPanel.setLayout(new BoxLayout(flaggerPanel, BoxLayout.Y_AXIS)); for (JCheckBox cb : flaggers) flaggerPanel.add(cb); subPanel.add(flaggerPanel); panel.add(subPanel); // Button Panel cancel = new JButton("Cancel"); cancel.setPreferredSize(new Dimension(80, 28)); cancel.addActionListener(this); flag = new JButton("Flag"); flag.setPreferredSize(new Dimension(80, 28)); flag.addActionListener(this); JPanel buttonPanel = new JPanel(); buttonPanel.add(cancel); buttonPanel.add(flag); panel.add(buttonPanel); add(panel); this.pack(); GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment(); int left = g.getCenterPoint().x - (int) (this.getPreferredSize().width / 2); this.setLocation(left, 0); this.setVisible(true); }