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

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

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

JComboBox.requestFocus介绍

暂无

代码示例

代码示例来源:origin: google/sagetv

public void run()
 {
  hookChoice.requestFocus();
 }
});

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

@Override
  public void focus() {
    comboBox.requestFocus();
    
  }
}

代码示例来源:origin: Multibit-Legacy/multibit-hd

@Override
public void afterShow() {
 languagesComboBox.requestFocus();
}

代码示例来源:origin: de.sciss/jsyntaxpane

private void showRegexpError(PatternSyntaxException ex) throws HeadlessException {
  JOptionPane.showMessageDialog(this, "Regexp error: " + ex.getMessage(),
    "Regular Expression Error", JOptionPane.ERROR_MESSAGE);
  jCmbFind.requestFocus();
}

代码示例来源:origin: de.sciss/syntaxpane

private void showRegexpError(PatternSyntaxException ex) throws HeadlessException {
  JOptionPane.showMessageDialog(this, "Regexp error: " + ex.getMessage(),
    "Regular Expression Error", JOptionPane.ERROR_MESSAGE);
  jCmbFind.requestFocus();
}

代码示例来源:origin: org.gdl-lang.gdl-tools/openehr-utils-gui-swing

protected JComboBox getComboBox() {
  if (comboBox == null) {
    comboBox = new JComboBox();
    comboBox.setRenderer(new DVComboBoxRendered());
    for (String nullFlavourCode : OpenEHRConstUI.NULL_FLAVOUR_MAP.keySet()) {
      comboBox.addItem(nullFlavourCode);
    }
    SwingUtilities.invokeLater(() -> comboBox.requestFocus());
  }
  return comboBox;
}

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

@Override
public void requestFocus() {
  super.requestFocus();
  command.requestFocus();
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

public void run()
 {
  if( _comboSearch.isShowing() )
  {
   _comboSearch.requestFocus();
  }
 }
} );

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-platform

/**
 * @param canManageGems whether the "Gem Manager" button is visible. Is used
 *        when Platform Customizer was called from Gem Manager to prevent
 *        creation of another Gem Manager.
 */
public static void manage(final JComboBox platforms, final boolean canManageGems) {
  RubyPlatformCustomizer.showCustomizer(canManageGems);
  RubyPlatform origPlatform = (RubyPlatform) platforms.getSelectedItem();
  platforms.setModel(new PlatformComponentFactory.RubyPlatformListModel()); // refresh
  platforms.setSelectedItem(origPlatform);
  platforms.requestFocus();
}

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

private void enableDisableDateFrom() {
  boolean enable = form.m_dateFromCB.isSelected();
  form.m_dateFromSpinner.setEnabled(enable);
  form.m_dateFromButton.setEnabled(enable);
  if (enable) {
    // move focus to date spinner
    form.m_dateFromSpinner.requestFocus();
  } else {
    // move focus to search edit field
    form.m_searchField.requestFocus();
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Makes the search field having focus.
 */
public void focusSearchField() {
  if (_textField != null && _textField.isVisible()) {
    _textField.requestFocus();
  }
  if (_comboBox != null && _comboBox.isVisible()) {
    _comboBox.requestFocus();
  }
}

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

private void enableDisableDateTo() {
  boolean enable = form.m_dateToCB.isSelected();
  form.m_dateToSpinner.setEnabled(enable);
  form.m_dateToButton.setEnabled(enable);
  if (enable) {
    // move focus to date spinner
    form.m_dateToSpinner.requestFocus();
  } else {
    // move focus to search edit field
    form.m_searchField.requestFocus();
  }
}

代码示例来源:origin: stackoverflow.com

Action actionListener = new AbstractAction() {
   @Override
   public void actionPerformed(ActionEvent actionEvent) {
     JComboBox source = (JComboBox) actionEvent.getSource();
     source.requestFocus();
     source.showPopup();
     // source.setFocusable(true);
   }
 };

代码示例来源:origin: org.gdl-lang.gdl-tools/openehr-utils-gui-swing

protected JComboBox getComboBox() {
  if (comboBox == null) {
    comboBox = new JComboBox();
    comboBox.setRenderer(new DVComboBoxRendered());
    if (isAllowsNull()) {
      comboBox.addItem(" ");
    }
    if (isRequestFocus()) {
      SwingUtilities.invokeLater(() -> comboBox.requestFocus());
    }
  }
  return comboBox;
}

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

private void enableDisableAuthor() {
  boolean editable = form.m_authorCB.isSelected();
  form.m_authorField.setEditable(editable);
  if (editable) {
    // move focus to author field
    form.m_authorField.requestFocus();
  } else {
    // move focus to search edit field
    form.m_searchField.requestFocus();
  }
}

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

/**
 * Focus the search field and select the current query text
 */
public void focusSearchField() {
  JComboBox<String> field = form.m_searchField;
  field.requestFocus();
  field.getEditor().selectAll();
}

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

@Override
  public void hierarchyChanged(HierarchyEvent e) {
    final Component component = e.getComponent();
    if(component.isShowing()){
      attributeNames.requestFocus();
      component.removeHierarchyListener(this);
    }
  }
});

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

public void focusInputField(final boolean selectAll) {
  if (values.isEnabled()) {
    values.requestFocus();
    final Component editorComponent = values.getEditor().getEditorComponent();
    if (selectAll && editorComponent instanceof JTextComponent) {
      ((JTextComponent) editorComponent).selectAll();
    }
    return;
  }
}

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

private void setErrorBackground(JComboBox comboBox) {
  JTextField text = ((JTextField) comboBox.getEditor().getEditorComponent());
  text.setBackground(ERROR_TEXTFIELD_BACKGROUND);
  Component[] comp = comboBox.getComponents();
  for (int i = 0; i < comp.length; i++) {// hack valid only for Metal L&F
    if (comp[i] instanceof MetalComboBoxButton) {
      MetalComboBoxButton coloredArrowsButton = (MetalComboBoxButton) comp[i];
      coloredArrowsButton.setBackground(null);
      break;
    }
  }
  comboBox.requestFocus();
}

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

private void setErrorBackground(JComboBox comboBox) {
  JTextField text = ((JTextField) comboBox.getEditor().getEditorComponent());
  text.setBackground(ERROR_TEXTFIELD_BACKGROUND);
  Component[] comp = comboBox.getComponents();
  for (int i = 0; i < comp.length; i++) {// hack valid only for Metal L&F
    if (comp[i] instanceof MetalComboBoxButton) {
      MetalComboBoxButton coloredArrowsButton = (MetalComboBoxButton) comp[i];
      coloredArrowsButton.setBackground(null);
      break;
    }
  }
  comboBox.requestFocus();
}

相关文章

JComboBox类方法