Esempio n. 1
0
  public CompletingComboBox(boolean strict) {
    super();
    this.strict = strict;
    removeActionListener(highlightListener);
    addActionListener(highlightListener);

    removePropertyChangeListener(configureModelPropertyListener);
    addPropertyChangeListener(configureModelPropertyListener);

    // Bug 5100422 on Java 1.5: Editable JComboBox won't hide popup when tabbing out
    hidePopupOnFocusLoss = System.getProperty("java.version").startsWith("1.5");
    // Highlight whole text when gaining focus
    configureEditor(getEditor());

    // Handle initially selected object
    Object selected = getSelectedItem();
    if (selected != null) plainDocument.setText(selected.toString());
    plainDocument.setText((String) getEditor().getItem());
    plainDocument.highlightCompletedText(0);

    /*this.addKeyListener(new KeyAdapter() {
      public void keyPressed(KeyEvent e) {
        if (!isPopupVisible() && isDisplayable()) setPopupVisible(true);
      }
    });*/
  }
Esempio n. 2
0
 public void focusGained(FocusEvent e) {
   plainDocument.highlightCompletedText(0);
 }
Esempio n. 3
0
 public void actionPerformed(ActionEvent e) {
   if (!selecting) plainDocument.highlightCompletedText(0);
 }