Package javax.swing

Examples of javax.swing.JList$DropLocation


    connect.addActionListener(this);

    mudListSelector.setVisibleRowCount(3);
    mudListSelector.addListSelectionListener(new ListSelectionListener() {
      public void valueChanged(ListSelectionEvent evt) {
        JList list = (JList) evt.getSource();
  list.ensureIndexIsVisible(list.getSelectedIndex());
        String item = (String) list.getSelectedValue();
        mudName.setText(item);
        Object mud[] = (Object[]) mudList.get(item);
        mudAddr.setText((String) mud[0]);
        mudPort.setText(((Integer) mud[1]).toString());
      }
View Full Code Here


        panel.setLayout(l);
        c.fill = GridBagConstraints.BOTH;

        int token;
        int ChoiceCount = 0;
        JList list;
        // parse the setup file
        try {
          while ((token = setup.nextToken()) != StreamTokenizer.TT_EOF) {
            switch (token) {
              case StreamTokenizer.TT_WORD:
                // reset the constraints
                c.gridwidth = 1;
                c.weightx = 0.0;
                c.weighty = 0.0;
                // keyword found, parse arguments
                if (setup.sval.equals("button")) {
                  if ((token = setup.nextToken()) != StreamTokenizer.TT_EOF) {
                    String descr = setup.sval;
                    if ((token = setup.nextToken()) != StreamTokenizer.TT_EOF) {
                      JButton b = new JButton(descr);
                      buttons.put(b, setup.sval);
                      b.addActionListener(ButtonBar.this);
                      l.setConstraints(b, constraints(c, setup));
                      panel.add(b);
                    } else
                      ButtonBar.this.error(descr + ": missing button command");
                  } else
                    ButtonBar.this.error("unexpected end of file");
                } else if (setup.sval.equals("label")) {
                  if ((token = setup.nextToken()) != StreamTokenizer.TT_EOF) {
                    String descr = setup.sval;
                    JLabel b = new JLabel(descr);
                    l.setConstraints(b, constraints(c, setup));
                    panel.add(b);
                  } else
                    ButtonBar.this.error("unexpected end of file");
                  /* choice - new stuff added APS 07-dec-2001 for Choice
                   * buttons
                   * Choice info is held in the choices hash. There are two
                   * sorts of hash entry:
                   * 1) for each choices button on the terminal, key=choice
                   *    object, value=ID ("C1.", "C2.", etc)
                   * 2) for each item, key=ID+user's text (eg "C1.opt1"),
                   *    value=user's command
                   */

                } else if (setup.sval.equals("choice")) {
                  ChoiceCount++;
                  String ident = "C" + ChoiceCount + ".";
                  list = new JList();
                  choices.put(list, ident);
                  list.addListSelectionListener(ButtonBar.this);// Choices use ItemListener, not Action
                  l.setConstraints(list, constraints(c, setup));
                  panel.add(list);
                  while ((token = setup.nextToken()) != StreamTokenizer.TT_EOF) {
                    if (isKeyword(setup.sval)) {// Got command ... Back off.
                      setup.pushBack();
                      break;
                    }
                    String descr = setup.sval;  // This is the hash key.
                    token = setup.nextToken();
                    if (token == StreamTokenizer.TT_EOF) {
                      ButtonBar.this.error("unexpected end of file");
                    } else {
                      String value = setup.sval;
                      if (isKeyword(value)) {   // Missing command - complain but continue
                        System.err.println(descr + ": missing choice command");
                        setup.pushBack();
                        break;
                      }
                      System.out.println("choice: name='" + descr + "', value='" + value);
                      list.add(descr, new JLabel(descr));
                      choices.put(ident + descr, value);
                    }
                  }
                  ButtonBar.this.error("choices hash: " + choices);
                } else if (setup.sval.equals("input")) {
View Full Code Here

  public void valueChanged(ListSelectionEvent evt) {
    String tmp, ident;
    if ((ident = (String) choices.get(evt.getSource())) != null) {
      // It's a choice - get the text from the selected item
      JList list = (JList) evt.getSource();
      tmp = (String) choices.get(ident + list.getSelectedValue());
      if (tmp != null) processEvent(tmp);
    }
  }
View Full Code Here

        openFolder = new JButton(I18N.getLocaleString("MODS_EDIT_OPEN_FOLDER"));
        addMod = new JButton(I18N.getLocaleString("MODS_EDIT_ADD_MOD"));
        disableMod = new JButton(I18N.getLocaleString("MODS_EDIT_DISABLE_MOD"));
        enableMod = new JButton(I18N.getLocaleString("MODS_EDIT_ENABLE_MOD"));

        enabledModsLst = new JList();
        disabledModsLst = new JList();

        enabledModsScl = new JScrollPane(enabledModsLst);
        disabledModsScl = new JScrollPane(disabledModsLst);

        panel.add(tabbedPane);
View Full Code Here

    dropDownVisibleThroughUIDelegate(comboBox, true);
  }

  @RunsInEDT
  private void selectItemAtIndex(@Nonnull final JComboBox comboBox, final int index) {
    JList dropDownList = dropDownListFinder.findDropDownList();
    if (dropDownList != null) {
      listDriver.selectItem(dropDownList, index);
      return;
    }
    setSelectedIndex(comboBox, index);
View Full Code Here

   * @return the found {@code JList}.
   * @throws ComponentLookupException if the {@code JList} in the pop-up could not be found.
   */
  @RunsInEDT
  public @Nonnull JList dropDownList() {
    JList list = dropDownListFinder.findDropDownList();
    if (list == null) {
      throw new ComponentLookupException("Unable to find the pop-up list for the JComboBox");
    }
    return list;
  }
View Full Code Here

*/
public class BasicJComboBoxCellReader implements JComboBoxCellReader {
  private static final JList REFERENCE_JLIST = newJList();

  private static @Nonnull JList newJList() {
    JList result = execute(new GuiQuery<JList>() {
      @Override
      protected @Nullable JList executeInEDT() {
        return new JList();
      }
    });
    return checkNotNull(result);
  }
View Full Code Here

  }

  @Test
  public void should_return_list_using_driver() {
    JComboBoxDriver driver = fixture.driver();
    JList list = mock(JList.class);
    when(driver.dropDownList()).thenReturn(list);
    assertThat(fixture.list()).isSameAs(list);
    verify(driver).dropDownList();
  }
View Full Code Here

   * @return the {@code String} representation of the given {@code JList}.
   */
  @RunsInCurrentThread
  @Override
  protected @Nonnull String doFormat(@Nonnull Component c) {
    JList list = (JList) c;
    String format = "%s[name=%s, selectedValues=%s, contents=%s, selectionMode=%s, enabled=%b, visible=%b, showing=%b]";
    return String.format(format, list.getClass().getName(), quote(list.getName()),
        Arrays.format(list.getSelectedValues()), Arrays.format(contentsOf(list)),
        SELECTION_MODES.get(list.getSelectionMode()), list.isEnabled(), list.isVisible(), list.isShowing());
  }
View Full Code Here

  }

  @Test
  public void should_find_drop_down_list() {
    showJComboBoxDropDownList();
    JList list = finder.findDropDownList();
    assertThat(list).isNotNull();
    assertThatListContains(list, "first", "second", "third");
  }
View Full Code Here

TOP

Related Classes of javax.swing.JList$DropLocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.