Пример #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());
  }
Пример #2
0
 /** Shows the command popup menu. */
 void showPopup() {
   final String query = getText();
   final int mode = gui.gprop.num(GUIProp.SEARCHMODE);
   if (cmdMode()) {
     cmdPopup(query);
   } else if (mode == 1 || mode == 0 && query.startsWith("/")) {
     queryPopup(query);
   } else {
     pop.setVisible(false);
   }
 }
Пример #3
0
 @Override
 public void setText(final String txt) {
   super.setText(txt);
   box.removeAllItems();
   pop.setVisible(false);
 }