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

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

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

JComboBox.getEditor介绍

暂无

代码示例

代码示例来源:origin: pentaho/mondrian

(JTextComponent) listEditor.getEditor().getEditorComponent();

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

public JTextComponent getTextComponent() {
    // returning the component of the combobox's editor
    return (JTextComponent) comboBox.getEditor().getEditorComponent();
  }
}

代码示例来源:origin: dubbo/jmeter-plugins-dubbo

public AutoCompleter(JComboBox comboBox) {
  owner = comboBox;
  editor = (JTextField) comboBox.getEditor().getEditorComponent();
  editor.addKeyListener(this);
  model = comboBox.getModel();
  // owner.addItemListener(this);
}

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

JComboBox comboBox = new JComboBox( ... );
comboBox.setEditable( true );
ComboBoxEditor editor = comboBox.getEditor();
JTextField textField = (JTextField)editor.getEditorComponent();
textField.setColumns(3);

代码示例来源:origin: org.swinglabs.swingx/swingx-all

private void handleEnabled(PropertyChangeEvent evt) {
  if (Boolean.TRUE.equals(evt.getNewValue())) {
    comboBox.setEditable(true);
  } else {
    JTextComponent textComponent = (JTextComponent) comboBox.getEditor().getEditorComponent();
    boolean strictMatching = ((AutoCompleteDocument) textComponent.getDocument()).strictMatching;
    
    comboBox.setEditable(!strictMatching);
  }
}

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

public void propertyChange(PropertyChangeEvent e) {
    if (e.getPropertyName().equals("editor")) {
      ComboBoxEditor editor = comboBox.getEditor();
      if (editor!=null && editor.getEditorComponent()!=null) {
        JComponent editorComponent = (JComponent) comboBox.getEditor().getEditorComponent();
        editorComponent.addKeyListener(this);
        editorComponent.setBorder(null);
      }
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-apisupport-wizards

private void addListeners() {
  className.getDocument().addDocumentListener(updateListener);
  displayName.getDocument().addDocumentListener(updateListener);
  Component editorComp = packageName.getEditor().getEditorComponent();
  if (editorComp instanceof JTextComponent) {
    ((JTextComponent) editorComp).getDocument().addDocumentListener(updateListener);
  }
}

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

@Override
public void installUI(JComponent c) {
 super.installUI(c);
 comboBox.setRequestFocusEnabled(true);
 if (comboBox.getEditor() != null) {
  if (comboBox.getEditor().getEditorComponent() instanceof JTextField) {
   ((JTextField) (comboBox.getEditor().getEditorComponent())).setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 1));
  }
 }
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

protected void clear() {
  if (comboBox.getEditor() != null) {
    Component editor = comboBox.getEditor().getEditorComponent();
    if (editor instanceof JComponent) {
      JComponent jEditor = (JComponent) editor;
      jEditor.setBackground(defaultBGColor);
      jEditor.setToolTipText(defaultToolTip);
    }
  }
}

代码示例来源:origin: net.sf.jt400/jt400

VSPMDListener(JComboBox box)
{
 box.addItemListener(this);
 box.getEditor().getEditorComponent().addKeyListener(this); // this line makes it possible to receive events when user types in a combo box
}
public void itemStateChanged(ItemEvent event)

代码示例来源:origin: org.java.net.substance/substance

@Override
  public JTextComponent getTextComponent(JComboBox t) {
    if (t.isEditable()) {
      Component editorComp = t.getEditor()
          .getEditorComponent();
      if (editorComp instanceof JTextComponent) {
        return (JTextComponent) editorComp;
      }
    }
    return null;
  }
});

代码示例来源:origin: net.java.abeille/abeille

/**
 * the method called to ensure that the input field would be a focused
 * component with the content selected
 */
public void popupNotify() {
  gotoCombo.getEditor().selectAll();
  gotoCombo.getEditor().getEditorComponent().requestFocus();
}

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

private void unregisterKeyboardActions() {
  ((JTextField) _comboBox.getEditor().getEditorComponent()).unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0));
  ((JTextField) _comboBox.getEditor().getEditorComponent()).unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
  ((JTextField) _comboBox.getEditor().getEditorComponent()).unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0));
  ((JTextField) _comboBox.getEditor().getEditorComponent()).unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

protected void initComponentDefaults() {
  this.errorColor = ValidatorDialog.WARNING_COLOR;
  if (comboBox.getEditor() != null) {
    Component editor = comboBox.getEditor().getEditorComponent();
    if (editor instanceof JComponent) {
      JComponent jEditor = (JComponent) editor;
      this.defaultBGColor = jEditor.getBackground();
      this.defaultToolTip = jEditor.getToolTipText();
    }
  }
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
  if (comboBoxPathChooser.getSelectedIndex() != -1 &&
      !((JTextComponent) (comboBoxPathChooser).
          getEditor().getEditorComponent()).getText().isEmpty()) {
    enterPressed(table);
  }
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

public void setText(String aValue) {
    if (isEditable()) {
      ((JTextComponent) super.getEditor().getEditorComponent()).setText(aValue);
    }
  }
}

代码示例来源:origin: com.jtattoo/JTattoo

public void installUI(JComponent c) {
  super.installUI(c);
  comboBox.setRequestFocusEnabled(true);
  if (comboBox.getEditor() != null) {
    if (comboBox.getEditor().getEditorComponent() instanceof JTextField) {
      ((JTextField) (comboBox.getEditor().getEditorComponent())).setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
    }
  }
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

private void classFieldChanged() {
  try {
    final JTextComponent tc = (JTextComponent) classField.getEditor().getEditorComponent();
    selectedClass = PromiscuousClassUtilsA.forName(tc.getText());
  } catch (Exception err) {
    selectedClass = null;
  }
  classBrowserButton.setEnabled(selectedClass != null || true);
}

代码示例来源:origin: com.github.insubstantial/substance

@Override
  public JTextComponent getTextComponent(JComboBox t) {
    if (t.isEditable()) {
      Component editorComp = t.getEditor()
          .getEditorComponent();
      if (editorComp instanceof JTextComponent) {
        return (JTextComponent) editorComp;
      }
    }
    return null;
  }
});

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

protected void initWarning(String message) {
    if (comboBox.getEditor() != null) {

      Component editor = comboBox.getEditor().getEditorComponent();
      if (editor instanceof JComponent) {
        JComponent jEditor = (JComponent) editor;
        jEditor.setBackground(errorColor);
        jEditor.setToolTipText(message);
      }
    }
  }
}

相关文章

JComboBox类方法