Пример #1
0
  /**
   * Creates and shows the combo box.
   *
   * @param sl strings to be added
   */
  private void createCombo(final StringList sl) {
    if (sl == null || sl.size() == 0) {
      pop.setVisible(false);
      return;
    }
    if (comboChanged(sl)) {
      box.setModel(new DefaultComboBoxModel(sl.toArray()));
      box.setSelectedIndex(-1);
      pop = new ComboPopup(box);
    }

    final int w = getFontMetrics(getFont()).stringWidth(pre);
    pop.show(this, Math.min(getWidth(), w), getHeight());
  }