/** * 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()); }
/** 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); } }
@Override public void setText(final String txt) { super.setText(txt); box.removeAllItems(); pop.setVisible(false); }