@Override public boolean isKnownComponent(Component c) { return (c == getEditor().getEditorComponent()); }
public boolean isKnownComponent(Component c) { return (c == getEditor().getEditorComponent()); }
public boolean isKnownComponent(Component c) { return (c == getEditor().getEditorComponent()); }
/** Overridden to use CleanComboUI on Metal L&F to avoid extra borders */ public void updateUI() { LookAndFeel lf = UIManager.getLookAndFeel(); String id = lf.getID(); boolean useClean = tableUI && (lf instanceof MetalLookAndFeel || "GTK".equals(id) || "Kunststoff".equals(id)); //NOI18N if (useClean) { super.setUI (PropUtils.createComboUI(this, tableUI)); } else { super.updateUI(); } if (tableUI & getEditor().getEditorComponent() instanceof JComponent) { ((JComponent) getEditor().getEditorComponent()).setBorder(null); } }
/** Overridden to use CleanComboUI on Metal L&F to avoid extra borders */ public void updateUI() { LookAndFeel lf = UIManager.getLookAndFeel(); String id = lf.getID(); boolean useClean = tableUI && (lf instanceof MetalLookAndFeel || "GTK".equals(id) || "Kunststoff".equals(id)); //NOI18N if (useClean) { super.setUI (PropUtils.createComboUI(this, tableUI)); } else { super.updateUI(); } if (tableUI & getEditor().getEditorComponent() instanceof JComponent) { ((JComponent) getEditor().getEditorComponent()).setBorder(null); } }
public Object getValue() { if (isEditable()) { return getEditor().getItem(); } else { return getSelectedItem(); } }
public Object getValue() { if (isEditable()) { return getEditor().getItem(); } else { return getSelectedItem(); } }
/** Overridden to add a listener to the editor if necessary, since the * UI won't do that for us without a focus listener */ public void addNotify() { super.addNotify(); if (isEditable() && getClass() == ComboInplaceEditor.class) { getEditor().getEditorComponent().addFocusListener(this); } getLayout().layoutContainer(this); }
/** Overridden to add a listener to the editor if necessary, since the * UI won't do that for us without a focus listener */ public void addNotify() { super.addNotify(); if (isEditable() && getClass() == ComboInplaceEditor.class) { getEditor().getEditorComponent().addFocusListener(this); } getLayout().layoutContainer(this); }
@Override public Object getValue() { if (isEditable()) { if( isAutoComplete ) { Object editorItem = getEditor().getItem(); if( null != editorItem ) { int selItem = ComboBoxAutoCompleteSupport.findMatch( this, editorItem.toString() ); if( selItem >= 0 && selItem < getItemCount() ) return getItemAt( selItem ); if( strictAutoCompleteMatching ) return getSelectedItem(); } } return getEditor().getItem(); } else { return getSelectedItem(); } }
/** Overridden to add a listener to the editor if necessary, since the * UI won't do that for us without a focus listener */ @Override public void addNotify() { super.addNotify(); if (isEditable() && (getClass() == ComboInplaceEditor.class)) { getEditor().getEditorComponent().addFocusListener(this); } getLayout().layoutContainer(this); }
/** Overridden to hide the popup and remove any listeners from the * combo editor */ @Override public void removeNotify() { log("Combo editor for " + editor + " removeNotify forcing popup close"); setPopupVisible(false); super.removeNotify(); getEditor().getEditorComponent().removeFocusListener(this); }
/** Overridden to hide the popup and remove any listeners from the * combo editor */ public void removeNotify() { log ("Combo editor for " + editor + " removeNotify forcing popup close"); setPopupVisible(false); super.removeNotify(); getEditor().getEditorComponent().removeFocusListener(this); }
/** Overridden to hide the popup and remove any listeners from the * combo editor */ public void removeNotify() { log ("Combo editor for " + editor + " removeNotify forcing popup close"); setPopupVisible(false); super.removeNotify(); getEditor().getEditorComponent().removeFocusListener(this); }
/** If the editor loses focus, we're done editing - fire COMMAND_FAILURE */ @Override public void focusLost(FocusEvent e) { Component c = e.getOppositeComponent(); if (!isAncestorOf(c) && (c != getEditor().getEditorComponent())) { if ((c == this) || (c instanceof SheetTable && ((SheetTable) c).isAncestorOf(this))) { //workaround for issue 38029 - editable combo editor can lose focus to ...itself return; } setActionCommand(COMMAND_FAILURE); log(" Combo editor lost focus - setting action command to " + COMMAND_FAILURE); getEditor().getEditorComponent().removeFocusListener(this); if (checker == null) { log("No active popup checker, firing action event"); fireActionEvent(); } } }
/** If the editor loses focus, we're done editing - fire COMMAND_FAILURE */ public void focusLost(FocusEvent e) { Component c = e.getOppositeComponent(); if (!isAncestorOf(c) && c != getEditor().getEditorComponent()) { if (c == this || (c instanceof SheetTable && ((SheetTable)c).isAncestorOf(this))) { //workaround for issue 38029 - editable combo editor can lose focus to ...itself return; } setActionCommand(COMMAND_FAILURE); log (" Combo editor lost focus - setting action command to " + COMMAND_FAILURE); getEditor().getEditorComponent().removeFocusListener(this); if (checker == null) { log ("No active popup checker, firing action event"); fireActionEvent(); } } }
private void prepareEditor() { Component c = getEditor().getEditorComponent(); if (c instanceof JTextComponent) { JTextComponent jtc = (JTextComponent) c; String s = jtc.getText(); if ((s != null) && (s.length() > 0)) { jtc.setSelectionStart(0); jtc.setSelectionEnd(s.length()); } if (tableUI) { jtc.setBackground(getBackground()); } else { jtc.setBackground(PropUtils.getTextFieldBackground()); } if( tableUI ) jtc.requestFocus(); } if (getLayout() != null) { getLayout().layoutContainer(this); } repaint(); }
/** Overridden to ensure the editor gets focus if editable */ @Override public void firePopupMenuCanceled() { super.firePopupMenuCanceled(); if (isEditable()) { Component focus = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); if (isDisplayable() && (focus == this)) { log("combo editor popup menu canceled. Requesting focus on editor component"); getEditor().getEditorComponent().requestFocus(); } } }
/** Overridden to ensure the editor gets focus if editable */ public void firePopupMenuCanceled() { super.firePopupMenuCanceled(); if (isEditable()) { Component focus = KeyboardFocusManager. getCurrentKeyboardFocusManager().getFocusOwner(); if (isDisplayable() && focus == this) { log ("combo editor popup menu canceled. Requesting focus on editor component"); getEditor().getEditorComponent().requestFocus(); } } }
/** Overridden to ensure the editor gets focus if editable */ public void firePopupMenuCanceled() { super.firePopupMenuCanceled(); if (isEditable()) { Component focus = KeyboardFocusManager. getCurrentKeyboardFocusManager().getFocusOwner(); if (isDisplayable() && focus == this) { log ("combo editor popup menu canceled. Requesting focus on editor component"); getEditor().getEditorComponent().requestFocus(); } } }