示例#1
0
 /**
  * Adds the connection speed options to the display.
  *
  * @param index The default index.
  * @param comp The component to add to the display.
  * @return See above.
  */
 private JPanel buildConnectionSpeed(int index, JComponent comp) {
   JPanel p = new JPanel();
   p.setBorder(BorderFactory.createTitledBorder("Connection Speed"));
   buttonsGroup = new ButtonGroup();
   JRadioButton button = new JRadioButton();
   button.setText("LAN");
   button.setActionCommand("" + HIGH_SPEED);
   button.addActionListener(this);
   button.setSelected(index == LoginCredentials.HIGH);
   buttonsGroup.add(button);
   p.add(button);
   button = new JRadioButton();
   button.setText("High (Broadband)");
   button.setActionCommand("" + MEDIUM_SPEED);
   button.setSelected(index == LoginCredentials.MEDIUM);
   button.addActionListener(this);
   buttonsGroup.add(button);
   p.add(button);
   button = new JRadioButton();
   button.setText("Low (Dial-up)");
   button.setActionCommand("" + LOW_SPEED);
   button.setSelected(index == LoginCredentials.LOW);
   button.addActionListener(this);
   buttonsGroup.add(button);
   p.add(button);
   if (comp == null) return p;
   JPanel content = new JPanel();
   content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
   content.add(comp);
   p = UIUtilities.buildComponentPanel(p);
   content.add(p);
   return content;
 }
示例#2
0
  private JPanel createRadioButtonPanel() {

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridLayout(1, 3));

    middleButton = new JRadioButton("Middle Page");
    middleButton.setHorizontalAlignment(AbstractButton.CENTER);
    middleButton.setActionCommand(Page.MIDDLE);
    middleButton.setEnabled(false);

    endButton = new JRadioButton("End Page");
    endButton.setHorizontalAlignment(AbstractButton.CENTER);
    endButton.setActionCommand(Page.END);
    endButton.setEnabled(false);

    initButton = new JRadioButton("Start Page");
    initButton.setHorizontalAlignment(AbstractButton.CENTER);
    initButton.setActionCommand(Page.START);
    initButton.setEnabled(false);

    ButtonGroup group = new ButtonGroup();
    group.add(initButton);
    group.add(middleButton);
    group.add(endButton);

    buttonPanel.add(initButton);
    buttonPanel.add(middleButton);
    buttonPanel.add(endButton);
    buttonPanel.setBorder(BorderFactory.createEtchedBorder());

    return buttonPanel;
  }
示例#3
0
  private JPanel createFoodTypeButtons(String[] array) {

    JPanel radioPanel = new JPanel();
    typeOfFood = new ArrayList<JRadioButton>();
    JRadioButton type0Radio = new JRadioButton(this.e.nonPerishableFood);
    JRadioButton type1Radio = new JRadioButton(this.e.perishableFood);

    typeOfFood.add(type0Radio);
    typeOfFood.add(type1Radio);

    type0Radio.setActionCommand(this.e.nonPerishableFood);
    type1Radio.setActionCommand(this.e.perishableFood);

    // Register a listener for the radio buttons.
    RadioListener myListener =
        new RadioListener(type0Radio, type1Radio, newCreatureButton, newJewelButton);
    type0Radio.addActionListener(myListener);
    type1Radio.addActionListener(myListener);

    // Group the radio buttons.
    group = new ButtonGroup();
    group.add(type0Radio);
    group.add(type1Radio);

    model = new DefaultButtonModel();
    group.setSelected(model, false);

    radioPanel.setLayout(new GridLayout(0, 1));
    radioPanel.add(type0Radio);
    radioPanel.add(type1Radio);

    return radioPanel;
  }
示例#4
0
  private void addListeners() {
    btnBrowse.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            FileDialog fd = new FileDialog(frame, "Snapshot File", FileDialog.LOAD);
            fd.show();
            String file = fd.getFile();

            if (file == null) return;

            file = fd.getDirectory() + file;
            fd.dispose();

            fldName.setText(file);
          }
        });

    btnCancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            cancel = true;
            close();
          }
        });

    btnNext.addActionListener(next);
    btnBack.addActionListener(back);
    btnNone.setActionCommand("none");
    btnInterval.setActionCommand("interval");
    btnPauseAndEnd.setActionCommand("pause");

    btnNone.addActionListener(captureAt);
    btnPauseAndEnd.addActionListener(captureAt);
    btnInterval.addActionListener(captureAt);
  }
  private JPanel getImageTypePanel() {
    buttonByteBinary = new JRadioButton("Byte Binary");
    buttonByteBinary.setActionCommand("ByteBinary");
    buttonByteBinary.addActionListener(this);
    buttonByteBinary.setSelected(true);
    params.setProperty("type", Integer.toString(BufferedImage.TYPE_BYTE_BINARY));

    buttonByteIndexed = new JRadioButton("Byte Indexed");
    buttonByteIndexed.setActionCommand("ByteIndexed");
    buttonByteIndexed.addActionListener(this);

    buttonByteGrayScaled = new JRadioButton("Byte Gray Scale");
    buttonByteGrayScaled.setActionCommand("ByteGrayScale");
    buttonByteGrayScaled.addActionListener(this);

    ButtonGroup group = new ButtonGroup();
    group.add(buttonByteBinary);
    group.add(buttonByteIndexed);
    group.add(buttonByteGrayScaled);

    JPanel p = new JPanel(new GridLayout(1, 0));
    p.setBorder(new TitledBorder(new EtchedBorder(), "Image Type"));
    p.add(buttonByteBinary);
    p.add(buttonByteIndexed);
    p.add(buttonByteGrayScaled);
    return p;
  }
  private JPanel getBPPPanel() {
    buttonBPP1 = new JRadioButton("1");
    buttonBPP1.setActionCommand("bpp1");
    buttonBPP1.addActionListener(this);
    buttonBPP1.setSelected(true);
    params.setProperty("bpp", "1");

    buttonBPP2 = new JRadioButton("2");
    buttonBPP2.setActionCommand("bpp2");
    buttonBPP2.addActionListener(this);

    buttonBPP4 = new JRadioButton("4");
    buttonBPP4.setActionCommand("bpp4");
    buttonBPP4.addActionListener(this);

    buttonBPP8 = new JRadioButton("8");
    buttonBPP8.setActionCommand("bpp8");
    buttonBPP8.addActionListener(this);
    buttonBPP8.setEnabled(false);

    ButtonGroup group = new ButtonGroup();
    group.add(buttonBPP1);
    group.add(buttonBPP2);
    group.add(buttonBPP4);
    group.add(buttonBPP8);

    JPanel p = new JPanel(new GridLayout(1, 0));
    p.setBorder(new TitledBorder(new EtchedBorder(), "Bits Per Pixel"));
    p.add(buttonBPP1);
    p.add(buttonBPP2);
    p.add(buttonBPP4);
    p.add(buttonBPP8);
    return p;
  }
示例#7
0
  protected JPanel north2() {
    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(5, 1));
    panel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));

    JLabel typeLabel = new JLabel("Model");
    JRadioButton dominantRB = new JRadioButton("Dominant");
    dominantRB.setActionCommand("Dominant");
    dominantRB.setSelected(true);
    JRadioButton recessiveRB = new JRadioButton("Recessive");
    recessiveRB.setActionCommand("Recessive");
    JRadioButton additiveRB = new JRadioButton("Additive");
    additiveRB.setActionCommand("Additive");
    JRadioButton alleleRB = new JRadioButton("Allele");
    alleleRB.setActionCommand("Allele");
    modelBgroup = new ButtonGroup();
    modelBgroup.add(dominantRB);
    modelBgroup.add(recessiveRB);
    modelBgroup.add(additiveRB);
    modelBgroup.add(alleleRB);
    dominantRB.addActionListener(this);
    recessiveRB.addActionListener(this);
    additiveRB.addActionListener(this);
    alleleRB.addActionListener(this);
    panel.add(typeLabel);
    panel.add(dominantRB);
    panel.add(recessiveRB);
    panel.add(additiveRB);
    panel.add(alleleRB);
    return panel;
  }
示例#8
0
  /** Constructs a <code>GDMInitDialog</code> with default initial parameters. */
  public GDMInitDialog(Frame parent, boolean useGenes) {
    super(parent, "Gene Distance Matrix Initialization", true);

    Listener listener = new Listener();
    addWindowListener(listener);

    ParameterPanel parameters = new ParameterPanel();
    parameters.setLayout(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;

    gbc.insets = new Insets(0, 0, 0, 0);
    genRadio = new JRadioButton("Genes");
    genRadio.setBackground(Color.white);
    genRadio.setFocusPainted(false);
    gbc.gridx = 0;
    gbc.gridy = 4;
    parameters.add(genRadio, gbc);

    expRadio = new JRadioButton("Samples");
    expRadio.setBackground(Color.white);
    expRadio.setFocusPainted(false);
    gbc.gridx = 1;
    gbc.gridy = 4;
    parameters.add(expRadio, gbc);

    ButtonGroup bg = new ButtonGroup();
    bg.add(genRadio);
    bg.add(expRadio);

    genRadio.setActionCommand("gene-radio-command");
    genRadio.addActionListener(listener);
    expRadio.setActionCommand("gene-radio-command");
    expRadio.addActionListener(listener);
    genRadio.setEnabled(useGenes);
    genRadio.setSelected(useGenes);
    expRadio.setEnabled(!useGenes);
    expRadio.setSelected(!useGenes);

    gbc.gridx = 0;
    gbc.gridy = 10;
    displayLabel = new JLabel("  Display Interval  ");
    parameters.add(displayLabel, gbc);

    gbc.gridx = 1;
    gbc.gridy = 10;
    textField = new JTextField(String.valueOf(1), 7);
    parameters.add(textField, gbc);

    this.addContent(parameters);
    this.setActionListeners(listener);
    pack();
  }
示例#9
0
  public NewGameDialog(GUI parent) {
    this.parent = parent;
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.setTitle("New game");
    this.setSize(250, 150);
    this.setResizable(false);
    this.setLocationRelativeTo(null);
    JPanel contentPane = new JPanel();
    this.add(contentPane);
    contentPane.setLayout(new FlowLayout()); // BoxLayout(contentPane, BoxLayout.PAGE_AXIS));

    SpinnerNumberModel model = new SpinnerNumberModel(1, 1, 3, 1);
    JLabel numAIlabel = new JLabel("Number of opponents:");
    numAIlabel.setMaximumSize(numAIlabel.getPreferredSize());
    contentPane.add(numAIlabel);

    numAI = new JSpinner(model); /*{
            @Override
            public Dimension getMaximumSize() {
                Dimension dim = super.getMaximumSize();
                dim.height = getPreferredSize().height;
                return dim;
            }
        };*/
    numAI.setEditor(new JSpinner.DefaultEditor(numAI));
    numAI.setPreferredSize(new Dimension(100, 30));

    // numAI.setMaximumSize(numAI.getPreferredSize());

    contentPane.add(numAI);
    chooseDifficulty = new ButtonGroup();
    JRadioButton easy = new JRadioButton("Easy");
    JRadioButton intermediate = new JRadioButton("Intermediate");
    JRadioButton hard = new JRadioButton("Hard");
    easy.setActionCommand("EASY");
    intermediate.setActionCommand("INTERMEDIATE");
    hard.setActionCommand("HARD");
    chooseDifficulty.add(easy);
    chooseDifficulty.add(intermediate);
    chooseDifficulty.add(hard);
    contentPane.add(easy);
    contentPane.add(intermediate);
    contentPane.add(hard);
    easy.doClick();
    JButton confirm = new JButton("Confirm");
    contentPane.add(confirm);
    confirm.addActionListener(this);

    this.setVisible(true);
  }
示例#10
0
  public static void main(String[] args) {
    JFrame frame = new JFrame("DriveThrough v1.0");

    JPanel entreePanel = new JPanel();
    final ButtonGroup entreeGroup = new ButtonGroup();
    JRadioButton radioButton;
    entreePanel.add(radioButton = new JRadioButton("Beef"));
    radioButton.setActionCommand("Beef");
    entreeGroup.add(radioButton);
    entreePanel.add(radioButton = new JRadioButton("Chicken"));
    radioButton.setActionCommand("Chicken");
    entreeGroup.add(radioButton);
    entreePanel.add(radioButton = new JRadioButton("Veggie", true));
    radioButton.setActionCommand("Veggie");
    entreeGroup.add(radioButton);

    final JPanel condimentsPanel = new JPanel();
    condimentsPanel.add(new JCheckBox("Ketchup"));
    condimentsPanel.add(new JCheckBox("Mustard"));
    condimentsPanel.add(new JCheckBox("Pickles"));

    JPanel orderPanel = new JPanel();
    JButton orderButton = new JButton("Place Order");
    orderPanel.add(orderButton);

    Container content = frame.getContentPane(); // unecessary in 1.5+
    content.setLayout(new GridLayout(3, 1));
    content.add(entreePanel);
    content.add(condimentsPanel);
    content.add(orderPanel);

    orderButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            String entree = entreeGroup.getSelection().getActionCommand();
            System.out.println(entree + " sandwich");
            Component[] components = condimentsPanel.getComponents();
            for (Component c : components) {
              JCheckBox cb = (JCheckBox) c;
              if (cb.isSelected()) System.out.println("With " + cb.getText());
            }
          }
        });

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(300, 150);
    frame.setVisible(true);
  }
示例#11
0
  private JRadioButton makeSearchInRadioButton(String label) {

    JRadioButton button = new JRadioButton(label, false);
    button.setActionCommand(label);
    searchIn.add(button);
    return button;
  }
示例#12
0
    public OptionsWindow() throws Exception {
      // Parses Lib Directory for all Files to list as OSM
      File dir = new File("lib");
      String[] maps =
          dir.list(
              new FilenameFilter() {
                public boolean accept(File arg0, String arg1) {
                  if (arg1.contains(".osm.xml")) return true;
                  return false;
                }
              });
      if (maps == null) {
        throw new Exception();
      }
      this.add(new JLabel("Map to Simulate"));
      mapChoice = new JComboBox(maps);
      this.add(mapChoice);

      // Speed for Simulator Default is 10
      this.add(new JLabel("Simulator Speed"));
      simSpeed = new JTextField("10", 2);
      this.add(simSpeed);

      // Traditional vs Interchange
      intersectionType = new ButtonGroup();
      JRadioButton t = new JRadioButton("Traditional");
      t.setActionCommand("Traditional");
      this.add(t);
      intersectionType.add(t);
      t = new JRadioButton("Bidding");
      t.setActionCommand("Bidding");
      this.add(t);
      t.setSelected(true);
      intersectionType.add(t);
      t = new JRadioButton("Loop Sensors");
      t.setActionCommand("Loop Sensors");
      this.add(t);
      t.setSelected(true);
      intersectionType.add(t);

      JButton subButton = new JButton("Start Simulation");
      subButton.addActionListener(this);
      this.add(subButton);
    }
  /** Create buttons for choosing the spatial criteria and a panel for them */
  private JComponent createSpatialButtons() {
    // JLabel label = new JLabel( GUIMessages.SPATIAL_CRITERIA );
    // label.setBounds(LEFT_MARGIN + 2, 370,200,18);
    // add(label);

    noCritButton = new JRadioButton(I18N.getString("AttributeResearchPanel.none"));
    noCritButton.setActionCommand(WFSPanel.NONE);
    noCritButton.doClick();
    bboxCritButton = new JRadioButton(I18N.getString("AttributeResearchPanel.bbox"));
    bboxCritButton.setActionCommand(WFSPanel.BBOX);
    bboxCritButton.setBounds(10, 30, 200, STD_HEIGHT);
    selecGeoButton = new JRadioButton(I18N.getString("AttributeResearchPanel.selectedGeometry"));
    selecGeoButton.setActionCommand(WFSPanel.SELECTED_GEOM);

    ActionListener bal =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JRadioButton rb = (JRadioButton) e.getSource();
            spatialSearchCriteria = rb.getActionCommand();
          }
        };
    noCritButton.addActionListener(bal);
    bboxCritButton.addActionListener(bal);
    selecGeoButton.addActionListener(bal);

    ButtonGroup bg = new ButtonGroup();
    bg.add(noCritButton);
    bg.add(bboxCritButton);
    bg.add(selecGeoButton);

    Box b = Box.createVerticalBox();
    b.setAlignmentX(0.95f);
    b.setBorder(
        BorderFactory.createTitledBorder(I18N.getString("AttributeResearchPanel.spatialCriteria")));

    b.add(noCritButton);
    b.add(bboxCritButton);
    b.add(selecGeoButton);
    b.setPreferredSize(new Dimension(150, 100));

    return b;
  }
示例#14
0
  protected JPanel north1() {
    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(3, 1));
    panel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));

    JLabel typeLabel = new JLabel("Type");
    alleleB = new JRadioButton("Allele");
    alleleB.setActionCommand("Allele");
    genotypeB = new JRadioButton("Genotype");
    genotypeB.setActionCommand("Genotype");
    genotypeB.setSelected(true);
    typeBgroup = new ButtonGroup();
    typeBgroup.add(genotypeB);
    typeBgroup.add(alleleB);
    genotypeB.addActionListener(this);
    alleleB.addActionListener(this);
    panel.add(typeLabel);
    panel.add(genotypeB);
    panel.add(alleleB);
    return panel;
  }
示例#15
0
  /**
   * Constructs a button panel.
   *
   * @param title the title shown in the border
   * @param options an array of radio button labels
   */
  public ButtonPanel(String title, String... options) {
    setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), title));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    group = new ButtonGroup();

    // make one radio button for each option
    for (String option : options) {
      JRadioButton b = new JRadioButton(option);
      b.setActionCommand(option);
      add(b);
      group.add(b);
      b.setSelected(option == options[0]);
    }
  }
  private JRadioButton add(
      String label, Display2DOptions.ContinFilterType type, JTextField text, JPanel panel) {
    JRadioButton button = new JRadioButton(label);

    if (Elegance.display2DOptions.getContinFilterType().equals(type)) {
      button.setSelected(true);
      text.setText(EString.join(Elegance.display2DOptions.getContinFilterCustom(), ","));
    }

    continFilterGroup.add(button);
    button.setActionCommand(type.name());
    panel.add(button);
    panel.add(text);
    return button;
  }
示例#17
0
 private void initStorage(
     LafParameterStorage storage, String label, TableLayoutBuilder tbllayStorage) {
   if (LafParameterProvider.getInstance().isStorageAllowed(parameter, storage)) {
     JRadioButton jrb = new JRadioButton(label);
     jrb.setActionCommand(storage.name());
     jrb.addActionListener(this);
     bgStorages.add(jrb);
     tbllayStorage.newRow();
     tbllayStorage.add(jrb);
     if (this.storage == null) {
       jrb.setSelected(true);
       setValueToEditor(storage);
     }
   }
 }
  public SettingsPanelController(CollageSettings settings) {
    this.settings = settings;
    this.settingsPanel = new SettingsPanel(settings);

    this.settingsPanel.getUsernameTextField().getDocument().addDocumentListener(this);
    Map<TimePeriod, JRadioButton> periodButtonMap =
        this.settingsPanel.getTimePeriodChooser().getPeriodButtons();
    for (TimePeriod period : periodButtonMap.keySet()) {
      JRadioButton button = periodButtonMap.get(period);
      button.addActionListener(this);
      button.setActionCommand(period.getLastfmString());
    }
    this.settingsPanel.getDimensionsPanel().getRowSpinner().getSpinner().addChangeListener(this);
    this.settingsPanel.getDimensionsPanel().getColSpinner().getSpinner().addChangeListener(this);
    this.settingsPanel.getShowNamesCheckBox().addItemListener(this);
  }
示例#19
0
  private JPanel initSearchFields() {

    JPanel p = new JPanel();
    p.setLayout(new GridLayout(6, 1, 5, 2));
    p.add(new JLabel("Search In: "));

    JRadioButton all = new JRadioButton("All", true);
    all.setActionCommand("All");
    searchIn.add(all);
    p.add(all);

    p.add(this.makeSearchInRadioButton("Name"));
    p.add(this.makeSearchInRadioButton("Mailbox"));
    p.add(this.makeSearchInRadioButton("Handle"));

    return p;
  }
  public void addComponentToPane(Container pane) {

    // Put the JComboBox in a JPanel to get a nicer look.

    JPanel birdsPanel = new JPanel(); // use FlowLayout

    String[] comboBoxItems = store.getBirdsTypeArray();

    JComboBox comboBoxBirds = new JComboBox(comboBoxItems);

    comboBoxBirds.setEditable(false);
    comboBoxBirds.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            CardLayout cl = (CardLayout) (cards.getLayout());
            cl.show(cards, (String) e.getItem());
          }
        });

    birdsPanel.add(comboBoxBirds);

    //
    cards = new JPanel(new CardLayout());
    for (String item : comboBoxItems) {
      JPanel card = new JPanel();

      JLabel label = new JLabel(item);
      card.add(label);
      System.out.println(
          item + "==" + BirdsType.valueOf(item) + "===" + store.getBirdsByTypeList(item).size());
      for (Bird bird : store.getBirdsByTypeList(item)) {
        System.out.println(bird.getName());
        JRadioButton rButton = new JRadioButton(bird.getName());
        rButton.setActionCommand(bird.getName());
        card.add(rButton);
      }

      cards.add(card, item);
    }

    pane.add(birdsPanel, BorderLayout.PAGE_START);
    pane.add(cards, BorderLayout.CENTER);
  }
  /** Creates the And/Or radio buttons, their button group and a panel for them */
  private JComponent createLogicalButtons() {

    andButton = new JRadioButton(I18N.getString("AttributeResearchPanel.logicalAnd"));
    andButton.setBorder(BorderFactory.createEmptyBorder(2, 10, 2, 10));
    andButton.setActionCommand(logicalRelationships[0]);
    andButton.doClick();

    orButton = new JRadioButton(I18N.getString("AttributeResearchPanel.logicalOr"));
    orButton.setBorder(BorderFactory.createEmptyBorder(2, 10, 5, 10));
    orButton.setActionCommand(logicalRelationships[1]);

    ActionListener bal =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JRadioButton rb = (JRadioButton) e.getSource();
            currentRelationship = rb.getActionCommand();
          }
        };
    andButton.addActionListener(bal);
    orButton.addActionListener(bal);

    ButtonGroup bg = new ButtonGroup();
    bg.add(andButton);
    bg.add(orButton);
    JPanel b = new JPanel();
    LayoutManager lm = new BoxLayout(b, BoxLayout.PAGE_AXIS);
    b.setLayout(lm);
    b.setAlignmentX(Component.LEFT_ALIGNMENT);
    b.setBorder(
        BorderFactory.createTitledBorder(I18N.getString("AttributeResearchPanel.logicalLink")));

    // add a bit of space
    b.add(Box.createRigidArea(new Dimension(20, 10)));
    b.add(andButton);
    b.add(Box.createRigidArea(new Dimension(20, 10)));
    b.add(orButton);
    b.setPreferredSize(new Dimension(150, 100));

    return b;
  }
示例#22
0
  private void addEquipSets(Set<String> eqSetIds) {
    /* just a temporary map to be able to lookup
    the name of an equipment set, given its ID */
    final Map<String, String> setId2Name = new HashMap<String, String>();

    for (EquipSet eset : pc.getEquipSet()) {
      setId2Name.put(eset.getIdPath(), eset.getName());
    }

    /* Create the buttons for the equipment sets. Note that we
    keep an internal reference to the buttons in a map, so that
    we can later remove them given an equipment set ID */
    for (String eqid : eqSetIds) {
      String setName = setId2Name.get(eqid);
      JRadioButton button = new JRadioButton(setName);
      button.setActionCommand(eqid);
      button.addActionListener(this);
      eqSets.add(button);
      eqSetPanel.add(button);
      eqSetWidgets.put(eqid, button);
    }
  }
示例#23
0
  private JPanel initRecordType() {

    JPanel p = new JPanel();
    p.setLayout(new GridLayout(6, 2, 5, 2));
    p.add(new JLabel("Search for:"));
    p.add(new JLabel(""));

    JRadioButton any = new JRadioButton("Any", true);
    any.setActionCommand("Any");
    searchFor.add(any);
    p.add(any);

    p.add(this.makeRadioButton("Network"));
    p.add(this.makeRadioButton("Person"));
    p.add(this.makeRadioButton("Host"));
    p.add(this.makeRadioButton("Domain"));
    p.add(this.makeRadioButton("Organization"));
    p.add(this.makeRadioButton("Group"));
    p.add(this.makeRadioButton("Gateway"));
    p.add(this.makeRadioButton("ASN"));

    return p;
  }
示例#24
0
        @SuppressWarnings("unchecked")
	public JPanel makeChoicePanel(JPanel p, int []_y) {
		int y=_y[0];
		GridBagConstraints c = new GridBagConstraints();
		c.fill = GridBagConstraints.NONE;
		
		c.anchor = GridBagConstraints.EAST;
		c.gridx = 0; c.gridy = y++;		
		TranslatedLabel label_choice = new TranslatedLabel("Vote");
		p.add(label_choice, c);
		c.gridx = 1;
		c.anchor = GridBagConstraints.WEST;
		choices = getChoices();
		p.add(vote_choice_field = new JComboBox(choices),c);
		vote_choice_field.addItemListener(this);
		
		vote_nojust_field = new JRadioButton(_("No Justification"));
		vote_oldjust_field = new JRadioButton(_("Old Justification"));
		vote_newjust_field = new JRadioButton(_("New Justification"));
		vote_nojust_field.setMnemonic(KeyEvent.VK_N);
		vote_oldjust_field.setMnemonic(KeyEvent.VK_O);
		vote_newjust_field.setMnemonic(KeyEvent.VK_W);
		vote_nojust_field.setActionCommand("j_none");
		vote_oldjust_field.setActionCommand("j_old");
		vote_newjust_field.setActionCommand("j_new");
		vote_nojust_field.setSelected(true);
		vote_oldjust_field.setSelected(false);
		vote_newjust_field.setSelected(false);
		ButtonGroup vote_j_group = new ButtonGroup();
		vote_j_group.add(vote_nojust_field);
		vote_j_group.add(vote_oldjust_field);
		vote_j_group.add(vote_newjust_field);		
		JPanel vj_panel=new JPanel();
		vj_panel.setLayout(new BoxLayout(vj_panel, BoxLayout.Y_AXIS));
		vj_panel.add(vote_nojust_field);
		vj_panel.add(vote_oldjust_field);
		vj_panel.add(vote_newjust_field);		
		vote_nojust_field.addActionListener(this);
		vote_oldjust_field.addActionListener(this);
		vote_newjust_field.addActionListener(this);
		
		c.anchor = GridBagConstraints.EAST;
		c.gridx = 0; c.gridy = y++;
		TranslatedLabel label_type = new TranslatedLabel("Type");
		p.add(label_type, c);
		c.gridx = 1;
		c.anchor = GridBagConstraints.WEST;
		p.add(vj_panel,c);
		
		c.anchor = GridBagConstraints.EAST;
		c.gridx = 0; c.gridy = y++;		
		TranslatedLabel label_old_just = new TranslatedLabel("Old Justification");
		p.add(label_old_just, c);
		c.gridx = 1;
		c.anchor = GridBagConstraints.WEST;
		p.add(just_old_just_field = new JComboBox(combo_answerTo),c);
		//p.add(just_answer_field = new JTextField(TITLE_LEN),c);
		//just_answer_field.getDocument().addDocumentListener(this);
		just_old_just_field.setEnabled(false);
		just_old_just_field.addItemListener(this);

		String creation_date = Util.getGeneralizedTime();
		vote_date_field = new JTextField(creation_date);
		vote_date_field.setColumns(creation_date.length());
		
		c.gridx = 0; c.gridy = y++;		
		c.anchor = GridBagConstraints.EAST;
		TranslatedLabel label_date = new TranslatedLabel("Creation Date");
		p.add(label_date, c);
		c.gridx = 1;
		c.anchor = GridBagConstraints.WEST;
		//hash_org.creation_date = creation_date;
		p.add(vote_date_field,c);
		vote_date_field.setForeground(Color.GREEN);
		//name_field.addActionListener(this); //name_field.addFocusListener(this);
		vote_date_field.getDocument().addDocumentListener(this);
		
		c.gridx = 0; c.gridy = y++;		
		c.gridx = 1;
		c.anchor = GridBagConstraints.WEST;
		p.add(vote_dategen_field = new JButton(_("Set Current Date")),c);
		vote_dategen_field.addActionListener(this);

		if (SUBMIT) {
			c.anchor = GridBagConstraints.EAST;
			c.gridx = 0; c.gridy = y++;		
			c.gridx = 1;
			c.anchor = GridBagConstraints.WEST;
			p.add(just_submit_field = new JButton(_("Submit Vote")),c);
			just_submit_field.addActionListener(this);
		}
		_y[0] = y;
		return p;
	}	
示例#25
0
  public ModeDialog() {
    super((java.awt.Frame) null, "Select connection mode", true);
    this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);

    JRadioButton serverMode = new JRadioButton("Server listening port:");
    serverMode.setActionCommand("server");
    serverMode.setSelected(true);
    JRadioButton clientMode = new JRadioButton("Client connect to:");
    clientMode.setActionCommand("client");

    this.choise_ = new ButtonGroup();
    this.choise_.add(serverMode);
    this.choise_.add(clientMode);

    this.serverPort_ = new JTextField();
    this.clientHost_ = new JTextField("localhost");
    this.clientHost_.setColumns(32);
    this.clientPort_ = new JTextField();
    this.clientPort_.setColumns(8);

    JButton ok = new JButton("Ok");
    ok.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            apply_ = true;
            setVisible(false);
          }
        });
    JButton cancel = new JButton("Cancel");
    cancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            apply_ = false;
            setVisible(false);
          }
        });

    this.getContentPane()
        .addKeyListener(
            new KeyAdapter() {
              public void keyPressed(KeyEvent e) {
                System.err.println("lasdjfoi");
                if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                  apply_ = true;
                  setVisible(false);
                }
              }
            });

    // layout
    this.setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));

    JPanel tmp = null;

    tmp = new JPanel();
    tmp.setLayout(new BoxLayout(tmp, BoxLayout.X_AXIS));
    tmp.add(serverMode);
    tmp.add(this.serverPort_);
    this.add(tmp);

    tmp = new JPanel();
    tmp.setLayout(new BoxLayout(tmp, BoxLayout.X_AXIS));
    tmp.add(clientMode);
    tmp.add(this.clientHost_);
    tmp.add(new JLabel(":"));
    tmp.add(this.clientPort_);
    this.add(tmp);

    tmp = new JPanel();
    tmp.setLayout(new BoxLayout(tmp, BoxLayout.X_AXIS));
    tmp.add(ok);
    tmp.add(cancel);
    this.add(tmp);

    this.pack();
  }
  public PreferenceProxyPanel(PreferencesProxyDTO preferencesProxyDTO) {
    super("Proxy", "preferenceProxyPanel.iconPath");

    this.preferencesProxyDTO = preferencesProxyDTO;

    proxySocksPanel = new JPanel();

    noProxyLabel = new JLabel("No proxy");
    noProxyRadioButton = new JRadioButton();
    noProxyRadioButton.setActionCommand("NoProxy");
    systemProxyLabel = new JLabel("Use system proxy settings");
    systemProxyRadioButton = new JRadioButton();
    systemProxyRadioButton.setActionCommand("systemProxy");
    manualProxyLabel = new JLabel("Manual proxy configuration");
    manualProxyRadioButton = new JRadioButton();
    manualProxyRadioButton.setActionCommand("manualProxy");
    proxySettingGroup = new ButtonGroup();
    proxySettingGroup.add(noProxyRadioButton);
    proxySettingGroup.add(systemProxyRadioButton);
    proxySettingGroup.add(manualProxyRadioButton);
    noProxyRadioButton.setEnabled(false); // todo for next release
    systemProxyRadioButton.setEnabled(false); // todo for next release
    manualProxyRadioButton.setEnabled(false); // todo for next release

    manualProxyPanel = new JPanel();

    useProxyLabel = new JLabel("Use Proxy");
    useProxyRadioButton = new JRadioButton();
    useSocksLabel = new JLabel("Use Socks");
    useSocksRadioButton = new JRadioButton();
    //   useProxyRadioButton.setSelected(true);
    proxySocksGroup = new ButtonGroup();
    proxySocksGroup.add(useProxyRadioButton);
    proxySocksGroup.add(useSocksRadioButton);

    proxyAddressLabel = new JLabel("URL address");
    proxyPortLabel = new JLabel("Post");
    proxyUserNameLabel = new JLabel("User name");
    proxyPasswordLabel = new JLabel("Password");

    socksProxyAddressLabel = new JLabel("URL address");
    socksProxyPortLabel = new JLabel("Post");
    socksProxyUserNameLabel = new JLabel("User name");
    socksProxyPasswordLabel = new JLabel("Password");

    httpLabel = new JLabel("HTTP");
    httpsLabel = new JLabel("HTTPS");
    ftpLabel = new JLabel("FTP");
    socksLabel = new JLabel("SOCKS");

    // http
    httpProxyAddressTextField = new JTextField(20);
    httpProxyPortSpinnerModel = new SpinnerNumberModel(80, 1, 9999, 1);
    httpProxyPortSpinner = new JSpinner(httpProxyPortSpinnerModel);
    httpProxyUserNameTextField = new JTextField(10);
    httpProxyPasswordField = new JPasswordField(10);

    // https
    httpsProxyAddressTextField = new JTextField(20);
    httpsProxyPortSpinnerModel = new SpinnerNumberModel(8080, 1, 9999, 1);
    httpsProxyPortSpinner = new JSpinner(httpsProxyPortSpinnerModel);
    httpsProxyUserNameTextField = new JTextField(10);
    httpsProxyPasswordField = new JPasswordField(10);

    // ftp
    ftpProxyAddressTextField = new JTextField(20);
    ftpProxyPortSpinnerModel = new SpinnerNumberModel(21, 1, 9999, 1);
    ftpProxyPortSpinner = new JSpinner(ftpProxyPortSpinnerModel);
    ftpProxyUserNameTextField = new JTextField(10);
    ftpProxyPasswordField = new JPasswordField(10);

    proxySocksGroup = new ButtonGroup();

    // socks
    socksProxyAddressTextField = new JTextField(20);
    socksProxyPortSpinnerModel = new SpinnerNumberModel(13, 1, 9999, 1);
    socksProxyPortSpinner = new JSpinner(socksProxyPortSpinnerModel);
    socksProxyUserNameTextField = new JTextField(10);
    socksProxyPasswordField = new JPasswordField(10);

    layoutComponentsOfProxySocksPanel();
    layoutComponentsOfManualProxyPanel();

    noProxyRadioButton.addActionListener(this);
    systemProxyRadioButton.addActionListener(this);
    manualProxyRadioButton.addActionListener(this);

    useProxyRadioButton.addActionListener(this);
    useSocksRadioButton.addActionListener(this);

    setPreferencesProxyDTO(preferencesProxyDTO);

    setEnableStatusOfComponents();
  }
  /** This method creates the buttons and set their place inside the Panel */
  private void initLanguageSelection() {
    try {
      this.setBorder(BorderFactory.createTitledBorder("Please select a language"));
      setLayout(null);

      /*
       * English Radio Button
       */
      englishButton = new JRadioButton();
      englishButton.setText("English");
      englishButton.setSelected(true);
      englishButton.setBounds(30, 40, 223, 20);
      englishButton.setActionCommand("en");
      englishButton.addActionListener(new LanguageChanged());
      add(englishButton);
      /*
       * French Radio Button
       */
      frenchButton = new JRadioButton();
      frenchButton.setText("Francais");
      frenchButton.setBounds(30, 65, 230, 20);
      frenchButton.setActionCommand("fr");
      frenchButton.addActionListener(new LanguageChanged());
      add(frenchButton);
      /*
       * Turkish Radio Button
       */
      turkishButton = new JRadioButton();
      turkishButton.setText("Turkce");
      turkishButton.setBounds(30, 90, 230, 20);
      turkishButton.setActionCommand("tr");
      turkishButton.addActionListener(new LanguageChanged());
      add(turkishButton);
      /*
       * Radio Button Group allows user to choose only one option at a
       * time.
       */
      languageButtonGroup = new ButtonGroup();
      languageButtonGroup.add(englishButton);
      languageButtonGroup.add(frenchButton);
      languageButtonGroup.add(turkishButton);

      okButton = new JButton();
      okButton.setBounds(180, 150, 99, 23);
      okButton.setIcon(new ImageIcon("icons/check.png"));
      add(okButton);

      exitButton = new JButton();
      exitButton.setBounds(280, 150, 99, 23);
      exitButton.setIcon(new ImageIcon("icons/exit.png"));
      add(exitButton);

      setButtonTexts();
    } catch (Exception e) {
      e.printStackTrace();
    }

    /*
     * This is where the action listener is implemented. This is for the
     * exit button
     */
    exitButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.exit(0);
          }
        });

    /*
     * This is where the action listener is implemented. This is for the ok
     * button
     */
    okButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            /*
             * There is triple getParent() function because parent of JPanel
             * is JLayeredPanel. We have to reach JFrame and JFrame is third
             * degree parent of JPanel
             */
            ((UserConsole) self.getParent().getParent().getParent()).switchPanels();
          }
        });
  }
示例#28
0
  public MakeReservation() {
    new BorderLayout();

    standardRoom.setMnemonic(KeyEvent.VK_K);
    standardRoom.setActionCommand("Standard Room");
    standardRoom.setSelected(true);

    familyRoom.setMnemonic(KeyEvent.VK_F);
    familyRoom.setActionCommand("Family Room");

    suiteRoom.setMnemonic(KeyEvent.VK_S);
    suiteRoom.setActionCommand("Suite");

    // Add Booking Button
    ImageIcon bookRoomIcon = createImageIcon("images/book.png");
    bookRoom = new JButton("Book Room", bookRoomIcon);
    bookRoom.setVerticalTextPosition(AbstractButton.BOTTOM);
    bookRoom.setHorizontalTextPosition(AbstractButton.CENTER);
    bookRoom.setMnemonic(KeyEvent.VK_M);
    bookRoom.addActionListener(this);
    bookRoom.setActionCommand("book");

    // Group the radio buttons.
    group.add(standardRoom);
    group.add(familyRoom);
    group.add(suiteRoom);

    // Create the labels.
    nameLabel = new JLabel("Name: ");
    amountroomsLabel = new JLabel("How many rooms? ");
    checkoutdateLabel = new JLabel("Check-Out Date: ");
    checkindateLabel = new JLabel("Check-In Date: ");

    // Create the text fields and set them up.
    nameField = new JFormattedTextField();
    nameField.setColumns(10);

    amountroomsField = new JFormattedTextField(new Integer(1));
    amountroomsField.setValue(new Integer(1));
    amountroomsField.setColumns(10);

    // java.util.Date dt_checkin = new java.util.Date();
    LocalDate today = LocalDate.now();
    // java.text.SimpleDateFormat sdf_checkin = new java.text.SimpleDateFormat("MM/dd/yyyy");
    currentDate_checkin = today.toString();
    checkindateField = new JFormattedTextField(currentDate_checkin);
    checkindateField.setColumns(10);

    // java.util.Date dt_checkout = new java.util.Date();
    LocalDate tomorrow = today.plus(1, ChronoUnit.DAYS);
    // java.text.SimpleDateFormat sdf_checkout = new java.text.SimpleDateFormat("MM/dd/yyyy");
    currentDate_checkout = tomorrow.toString();
    checkoutdateField = new JFormattedTextField(currentDate_checkout);
    checkoutdateField.setColumns(10);

    // Tell accessibility tools about label/textfield pairs.
    nameLabel.setLabelFor(nameField);
    amountroomsLabel.setLabelFor(amountroomsField);
    checkoutdateLabel.setLabelFor(checkoutdateField);
    checkindateLabel.setLabelFor(checkindateField);

    // Lay out the labels in a panel.
    JPanel labelPane1 = new JPanel(new GridLayout(0, 1));

    labelPane1.add(amountroomsLabel);

    JPanel labelPane3 = new JPanel(new GridLayout(0, 1));
    labelPane3.add(checkindateLabel);

    JPanel labelPane2 = new JPanel(new GridLayout(0, 1));
    labelPane2.add(checkoutdateLabel);

    JPanel labelPane4 = new JPanel(new GridLayout(0, 1));
    labelPane4.add(nameLabel);

    // Layout the text fields in a panel.
    JPanel fieldPane1 = new JPanel(new GridLayout(0, 1));
    fieldPane1.add(amountroomsField);

    JPanel fieldPane3 = new JPanel(new GridLayout(0, 1));
    fieldPane3.add(checkindateField);

    JPanel fieldPane2 = new JPanel(new GridLayout(0, 1));
    fieldPane2.add(checkoutdateField);

    JPanel fieldPane4 = new JPanel(new GridLayout(0, 1));
    fieldPane4.add(nameField);

    // Put the radio buttons in a column in a panel.
    JPanel radioPanel = new JPanel(new GridLayout(0, 1));
    radioPanel.add(standardRoom);
    radioPanel.add(familyRoom);
    radioPanel.add(suiteRoom);

    // Put the panels in this panel, labels on left,
    // text fields on right.
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
    add(labelPane1, BorderLayout.LINE_START);
    add(fieldPane1, BorderLayout.LINE_END);
    add(labelPane3, BorderLayout.LINE_START);
    add(fieldPane3, BorderLayout.LINE_END);
    add(labelPane2, BorderLayout.LINE_START);
    add(fieldPane2, BorderLayout.LINE_END);
    add(labelPane4, BorderLayout.LINE_START);
    add(fieldPane4, BorderLayout.LINE_END);

    add(radioPanel, BorderLayout.LINE_END);
    add(bookRoom);
  }
示例#29
0
  private static JPanel initOptionsPane() {
    JPanel pane = null;
    ActionAdapter buttonListener = null;

    // Create an options pane
    JPanel optionsPane = new JPanel(new GridLayout(4, 1));

    // IP address input
    pane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    pane.add(new JLabel("Host IP:"));
    ipField = new JTextField(10);
    ipField.setText(hostIP);
    ipField.setEnabled(false);
    ipField.addFocusListener(
        new FocusAdapter() {
          public void focusLost(FocusEvent e) {
            ipField.selectAll();
            // Should be editable only when disconnected
            if (connectionStatus != DISCONNECTED) {
              changeStatusNTS(NULL, true);
            } else {
              hostIP = ipField.getText();
            }
          }
        });
    pane.add(ipField);
    optionsPane.add(pane);

    // Port input
    pane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    pane.add(new JLabel("Port:"));
    portField = new JTextField(10);
    portField.setEditable(true);
    portField.setText((new Integer(port)).toString());
    portField.addFocusListener(
        new FocusAdapter() {
          public void focusLost(FocusEvent e) {
            // should be editable only when disconnected
            if (connectionStatus != DISCONNECTED) {
              changeStatusNTS(NULL, true);
            } else {
              int temp;
              try {
                temp = Integer.parseInt(portField.getText());
                port = temp;
              } catch (NumberFormatException nfe) {
                portField.setText((new Integer(port)).toString());
                mainFrame.repaint();
              }
            }
          }
        });
    pane.add(portField);
    optionsPane.add(pane);

    // Host/guest option
    buttonListener =
        new ActionAdapter() {
          public void actionPerformed(ActionEvent e) {
            if (connectionStatus != DISCONNECTED) {
              changeStatusNTS(NULL, true);
            } else {
              isHost = e.getActionCommand().equals("host");

              // Cannot supply host IP if host option is chosen
              if (isHost) {
                ipField.setEnabled(false);
                ipField.setText("localhost");
                hostIP = "localhost";
              } else {
                ipField.setEnabled(true);
              }
            }
          }
        };
    ButtonGroup bg = new ButtonGroup();
    hostOption = new JRadioButton("Host", true);
    hostOption.setMnemonic(KeyEvent.VK_H);
    hostOption.setActionCommand("host");
    hostOption.addActionListener(buttonListener);
    guestOption = new JRadioButton("Guest", false);
    guestOption.setMnemonic(KeyEvent.VK_G);
    guestOption.setActionCommand("guest");
    guestOption.addActionListener(buttonListener);
    bg.add(hostOption);
    bg.add(guestOption);
    pane = new JPanel(new GridLayout(1, 2));
    pane.add(hostOption);
    pane.add(guestOption);
    optionsPane.add(pane);

    // Connect/disconnect buttons
    JPanel buttonPane = new JPanel(new GridLayout(1, 2));
    buttonListener =
        new ActionAdapter() {
          public void actionPerformed(ActionEvent e) {
            // Request a connection initiation
            if (e.getActionCommand().equals("connect")) {
              changeStatusNTS(BEGIN_CONNECT, true);
            }
            // Disconnect
            else {
              changeStatusNTS(DISCONNECTING, true);
            }
          }
        };
    connectButton = new JButton("Connect");
    connectButton.setMnemonic(KeyEvent.VK_C);
    connectButton.setActionCommand("connect");
    connectButton.addActionListener(buttonListener);
    connectButton.setEnabled(true);
    disconnectButton = new JButton("Disconnect");
    disconnectButton.setMnemonic(KeyEvent.VK_D);
    disconnectButton.setActionCommand("disconnect");
    disconnectButton.addActionListener(buttonListener);
    disconnectButton.setEnabled(false);
    buttonPane.add(connectButton);
    buttonPane.add(disconnectButton);
    optionsPane.add(buttonPane);

    return optionsPane;
  }
示例#30
0
  public static void filterSearch() {
    final JFrame frame = new JFrame("Filter Options");
    JLabel instructions = new JLabel("Choose the elements you wish to filter for the search: ");
    JLabel age = new JLabel("Age: ");
    JLabel gender = new JLabel("Sex: ");
    JLabel hand = new JLabel("Handedness: ");
    JLabel wave = new JLabel("Wave Type: ");

    JButton button = new JButton("Continue");

    GridLayout buttonLayout = new GridLayout(0, 2);
    GridLayout bigLayout = new GridLayout(4, 2);

    JPanel bigPanel = new JPanel();
    bigPanel.setLayout(bigLayout);
    JPanel agePanel = new JPanel();
    agePanel.setLayout(buttonLayout);
    JPanel genderPanel = new JPanel();
    genderPanel.setLayout(buttonLayout);
    JPanel handPanel = new JPanel();
    handPanel.setLayout(buttonLayout);
    JPanel wavePanel = new JPanel();
    wavePanel.setLayout(buttonLayout);

    // Create Action Groups
    final ButtonGroup ageGroup = new ButtonGroup();
    JRadioButton yesAge = new JRadioButton("Yes");
    JRadioButton noAge = new JRadioButton("No");
    noAge.setActionCommand("noAge");
    noAge.setSelected(true);
    yesAge.setActionCommand("yesAge");
    ageGroup.add(yesAge);
    ageGroup.add(noAge);

    final ButtonGroup genderGroup = new ButtonGroup();
    JRadioButton yesGender = new JRadioButton("Yes");
    JRadioButton noGender = new JRadioButton("No");
    noGender.setActionCommand("noGender");
    noGender.setSelected(true);
    yesGender.setActionCommand("yesGender");
    genderGroup.add(yesGender);
    genderGroup.add(noGender);

    final ButtonGroup handGroup = new ButtonGroup();
    JRadioButton yesHand = new JRadioButton("Yes");
    JRadioButton noHand = new JRadioButton("No");
    noHand.setActionCommand("noHand");
    noHand.setSelected(true);
    yesHand.setActionCommand("yesHand");
    handGroup.add(yesHand);
    handGroup.add(noHand);

    final ButtonGroup waveGroup = new ButtonGroup();
    JRadioButton yesWave = new JRadioButton("Yes");
    yesWave.setActionCommand("yesWave");
    JRadioButton noWave = new JRadioButton("No");
    noWave.setActionCommand("noWave");
    noWave.setSelected(true);
    waveGroup.add(yesWave);
    waveGroup.add(noWave);

    agePanel.add(yesAge);
    agePanel.add(noAge);
    genderPanel.add(yesGender);
    genderPanel.add(noGender);
    handPanel.add(yesHand);
    handPanel.add(noHand);
    wavePanel.add(yesWave);
    wavePanel.add(noWave);

    bigPanel.add(age);
    bigPanel.add(agePanel);
    bigPanel.add(gender);
    bigPanel.add(genderPanel);
    bigPanel.add(hand);
    bigPanel.add(handPanel);
    bigPanel.add(wave);
    bigPanel.add(wavePanel);

    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            StringBuilder sb = new StringBuilder("Select * from eeg where ");
            String command = null;
            int count = 0;

            command = ageGroup.getSelection().getActionCommand();

            if (command.equals("yesAge")) {
              count++;
              sb.append(ageCondition() + " ");
            }

            command = genderGroup.getSelection().getActionCommand();
            if (command.equals("yesGender")) {
              if (count != 0) sb.append("AND ");
              count++;
              sb.append(genderCondition() + " ");
            }

            command = handGroup.getSelection().getActionCommand();
            if (command.equals("yesHand")) {
              if (count != 0) sb.append("AND ");
              count++;
              sb.append(handCondition() + " ");
            }

            command = waveGroup.getSelection().getActionCommand();
            if (command.equals("yesWave")) {
              if (count != 0) sb.append("AND ");
              count++;
              sb.append(waveCondition() + " ");
            }
            String query;
            sb.append(";");
            if (count == 0) query = "Select * from eeg;";
            else query = String.valueOf(sb);

            frame.setVisible(false);
            displayData(query);
          }
        });

    frame.add(instructions, BorderLayout.NORTH);
    frame.add(bigPanel, BorderLayout.CENTER);
    frame.add(button, BorderLayout.SOUTH);
    frame.setSize(400, 300);
    frame.setVisible(true);
  }