Refine search
(JTextComponent) listEditor.getEditor().getEditorComponent();
public JTextComponent getTextComponent() { // returning the component of the combobox's editor return (JTextComponent) comboBox.getEditor().getEditorComponent(); } }
public AutoCompleter(JComboBox comboBox) { owner = comboBox; editor = (JTextField) comboBox.getEditor().getEditorComponent(); editor.addKeyListener(this); model = comboBox.getModel(); // owner.addItemListener(this); }
JComboBox comboBox = new JComboBox( ... ); comboBox.setEditable( true ); ComboBoxEditor editor = comboBox.getEditor(); JTextField textField = (JTextField)editor.getEditorComponent(); textField.setColumns(3);
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); } }
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); } } } }
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); } }
@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)); } } }
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); } } }
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)
@Override public JTextComponent getTextComponent(JComboBox t) { if (t.isEditable()) { Component editorComp = t.getEditor() .getEditorComponent(); if (editorComp instanceof JTextComponent) { return (JTextComponent) editorComp; } } return null; } });
/** * 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(); }
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)); }
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(); } } }
@Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { if (comboBoxPathChooser.getSelectedIndex() != -1 && !((JTextComponent) (comboBoxPathChooser). getEditor().getEditorComponent()).getText().isEmpty()) { enterPressed(table); } }
public void setText(String aValue) { if (isEditable()) { ((JTextComponent) super.getEditor().getEditorComponent()).setText(aValue); } } }
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)); } } }
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); }
@Override public JTextComponent getTextComponent(JComboBox t) { if (t.isEditable()) { Component editorComp = t.getEditor() .getEditorComponent(); if (editorComp instanceof JTextComponent) { return (JTextComponent) editorComp; } } return null; } });
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); } } } }