javax.swing.JComboBox.hidePopup()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(235)

本文整理了Java中javax.swing.JComboBox.hidePopup()方法的一些代码示例,展示了JComboBox.hidePopup()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComboBox.hidePopup()方法的具体详情如下:
包路径:javax.swing.JComboBox
类名称:JComboBox
方法名:hidePopup

JComboBox.hidePopup介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javafx2-project

public void hidePopup() {
  combo.hidePopup();
}

代码示例来源:origin: abbot/abbot

@Override
  public void run() {
    if (cb.isPopupVisible()) {
      cb.hidePopup();
    }
  }
});

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-bugtracking

private void textChanged () {
    if(ignoreCommandChanges) {
      return;
    }
    if (isTextFieldFocusOwner()) {
      if(!editor.getText().equals("")) {
        command.hidePopup();
      }
      displayer.maybeEvaluate(editor.getText());
    }
    setItem(null, true);
  }
});

代码示例来源:origin: PavlikPolivka/GitLabProjects

private void dataChanged() {
  super.fireContentsChanged(this, 0, data.size());
  comboBox.hidePopup();
  comboBox.showPopup();
  if (!data.isEmpty()) {
    comboBox.setSelectedIndex(0);
  }
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-ui

private void jComboBoxPartRevisionPopupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jComboBoxPartRevisionPopupMenuWillBecomeVisible
  if (!repopup) {
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    Object partNumber = jComboBoxPartNumber.getSelectedItem();
//        for (String revName : (new PartNumberRevsQuery(testStation, partNumber != null ? partNumber.toString() : null)).query()) {
    for (String element : getTestStation().getPartNumberRevs(partNumber == null ? null : partNumber.toString())) {
      model.addElement(element);
    }
    jComboBoxPartRevision.setModel(model);
    repopup = true;
    jComboBoxPartRevision.hidePopup();
    jComboBoxPartRevision.showPopup();
    repopup = false;
  }
}//GEN-LAST:event_jComboBoxPartRevisionPopupMenuWillBecomeVisible

代码示例来源:origin: org.codehaus.jtstand/jtstand-ui

private void jComboBoxTestTypePopupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jComboBoxTestTypePopupMenuWillBecomeVisible
  if (!repopup) {
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    Object partNumber = jComboBoxPartNumber.getSelectedItem();
    Object partRevision = jComboBoxPartRevision.getSelectedItem();
//        for (String revName : (new PartNumberRevsQuery(testStation, partNumber != null ? partNumber.toString() : null)).query()) {
    for (String element : getTestStation().getTestTypes(partNumber == null ? null : partNumber.toString(), partRevision == null ? null : partRevision.toString())) {
      model.addElement(element);
    }
    jComboBoxTestType.setModel(model);
    repopup = true;
    jComboBoxTestType.hidePopup();
    jComboBoxTestType.showPopup();
    repopup = false;
  }

}//GEN-LAST:event_jComboBoxTestTypePopupMenuWillBecomeVisible

代码示例来源:origin: org.codehaus.jtstand/jtstand-ui

private void jComboBoxFixturePopupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jComboBoxFixturePopupMenuWillBecomeVisible
  if (!repopup) {
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    Object hostName = jComboBoxStation.getSelectedItem();
//        for (String fixtureName : (new FixtureNamesQuery(testStation, hostName != null ? hostName.toString() : null)).query()) {
    for (String fixtureName : getTestStation().getTestFixtureNames(hostName != null ? hostName.toString() : null)) {
      model.addElement(fixtureName);
    }
    jComboBoxFixture.setModel(model);
    repopup = true;
    jComboBoxFixture.hidePopup();
    jComboBoxFixture.showPopup();
    repopup = false;
  }
}//GEN-LAST:event_jComboBoxFixturePopupMenuWillBecomeVisible

代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets

@Override
public void keyPressed(KeyEvent e) {
  if (!ui.isEnabled()) {
    e.consume();
    return;
  }
  if (log.isDebugEnabled()) {
    log.debug("keyPressed: " + e.getKeyCode());
  }
  if (combobox.isPopupVisible() && ui.isEnterToSelectUniqueUniverse()) {
    if (KeyEvent.VK_ENTER == e.getKeyCode() && combobox.getItemCount() == 1) {
      // we don't want any other action for this one
      if (log.isDebugEnabled()) {
        log.debug("ENTER + only one selected item, consume");
      }
      combobox.hidePopup();
      e.consume();
      return;
    }
  }
}

代码示例来源:origin: omegat-org/omegat

@Override
  public void actionPerformed(ActionEvent e) {
    if (box.isPopupVisible()) {
      box.hidePopup();
    } else {
      doCancel();
    }
  }
});

代码示例来源:origin: org.codehaus.jtstand/jtstand-ui

private void jComboBoxStationPopupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jComboBoxStationPopupMenuWillBecomeVisible
  if (!repopup) {
    DefaultComboBoxModel model = new DefaultComboBoxModel();
//        for (String hostName : (new HostNamesQuery(testStation)).query()) {
    for (String hostName : getTestStation().getHostNames()) {
      model.addElement(hostName);
    }
    jComboBoxStation.setModel(model);
    repopup = true;
    jComboBoxStation.hidePopup();
    jComboBoxStation.showPopup();
    repopup = false;
  }

}//GEN-LAST:event_jComboBoxStationPopupMenuWillBecomeVisible

代码示例来源:origin: org.codehaus.jtstand/jtstand-ui

private void jComboBoxPartNumberPopupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jComboBoxPartNumberPopupMenuWillBecomeVisible
  if (!repopup) {
    DefaultComboBoxModel model = new DefaultComboBoxModel();
//        for (String partNumber : (new PartNumbersQuery(testStation).query())) {
    for (String partNumber : getTestStation().getPartNumbers()) {
      model.addElement(partNumber);
    }
    jComboBoxPartNumber.setModel(model);
    repopup = true;
    jComboBoxPartNumber.hidePopup();
    jComboBoxPartNumber.showPopup();
    repopup = false;
  }
}//GEN-LAST:event_jComboBoxPartNumberPopupMenuWillBecomeVisible

代码示例来源:origin: com.googlecode.vfsjfilechooser2/vfsjfilechooser2

public void actionPerformed(ActionEvent e)
  {
    directoryComboBox.hidePopup();
    FileObject folder = (FileObject) directoryComboBox.getSelectedItem();
    if (!getFileChooser().getCurrentDirectory().equals(folder))
    {
      getFileChooser().setCurrentDirectoryObject(folder);
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

public void keyTyped(KeyEvent evt) {
  if (evt.getKeyChar() == '\n') {
    findButtons[0].doClick(20);
    evt.consume();
    ((JComboBox)((JTextField)evt.getSource()).getParent()).hidePopup();
  } else {
    postChangeCombos();
  }
}

代码示例来源:origin: net.sf.cuf/cuf-swing

public void focusLost(final FocusEvent pE)
{
  // if the filtering content is invalid after focus lost -> delete it
  if (pDeleteInvalidFilterAfterFocusLost)
  {
    deleteFilteringTextIfInvalid();
  }
  mComboBox.hidePopup();
  mModel.setPattern("");
  mDocument.clearFlags();
}

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java15

/**
 * A small convenience method to try showing the ComboBoxPopup.
 */
private void togglePopup() {
  // break out early if we're flagged to ignore attempts to toggle the popup state
  if (doNotTogglePopup) return;
  if (comboBoxModel.getSize() == 0)
    comboBox.hidePopup();
  else if (comboBox.isShowing() && !comboBox.isPopupVisible() && comboBoxEditorComponent.hasFocus())
    comboBox.showPopup();
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets

protected void updateFilter() {
  JComboBox comboBox = ui.getCombobox();
  JaxxFilterableComboBoxModel model = (JaxxFilterableComboBoxModel) comboBox.getModel();
  JTextComponent editorComponent = (JTextComponent) comboBox.getEditor().getEditorComponent();
  // hide the popup before setting the filter, otherwise the popup height does not fit
  boolean wasPopupVisible = comboBox.isShowing() && comboBox.isPopupVisible();
  if (wasPopupVisible) {
    comboBox.hidePopup();
  }
  String text = editorComponent.getText();
  if (ui.getSelectedItem() != null) {
    text = "";
  }
  if (log.isDebugEnabled()) {
    log.debug("updateFilter " + text);
  }
  model.setFilterText(text);
  if (wasPopupVisible) {
    comboBox.showPopup();
  }
}

代码示例来源:origin: net.sf.cuf/cuf-swing

/**
 * Triggers the filtering for the given pattern.
 *
 * @param pPattern Pattern to filter after.
 */
public void setPattern(final String pPattern)
{
  List pre = mData.getData();
  mData.setPattern(pPattern);
  List post = mData.getData();
  // update dropdown content if necessary
  if (!pre.equals(post))
  {
    // Workround over a Swing bug. See: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4743225
    if (mComboBox.isPopupVisible())
    {
      mComboBox.hidePopup();
      mComboBox.showPopup();
    }
  }
}

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java16

/**
 * A small convenience method to try showing the ComboBoxPopup.
 */
private void togglePopup() {
  // break out early if we're flagged to ignore attempts to toggle the popup state
  if (doNotTogglePopup) return;
  if (comboBoxModel.getSize() == 0)
    comboBox.hidePopup();
  else if (comboBox.isShowing() && !comboBox.isPopupVisible() && comboBoxEditorComponent.hasFocus())
    comboBox.showPopup();
}

代码示例来源:origin: com.haulmont.thirdparty/glazedlists

/**
 * A small convenience method to try showing the ComboBoxPopup.
 */
private void togglePopup() {
  // break out early if we're flagged to ignore attempts to toggle the popup state
  if (doNotTogglePopup) return;
  if (comboBoxModel.getSize() == 0) {
    comboBox.hidePopup();
  }
  else if (comboBox.isShowing() && !comboBox.isPopupVisible() && comboBoxEditorComponent.hasFocus())
    comboBox.showPopup();
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets

/**
 * Reset the combo-box; says remove any selected item and filter text.
 */
public void reset() {
  if (ui.getSelectedItem() != null) {
    ui.setSelectedItem(null);
  } else {
    JTextComponent editorComponent = (JTextComponent) ui.getCombobox().getEditor().getEditorComponent();
    editorComponent.setText("");
  }
  JComboBox comboBox = ui.getCombobox();
  if (comboBox.isShowing()) {
    comboBox.hidePopup();
  }
}

相关文章

JComboBox类方法