Top Description Inners Fields Constructors Methods
javax.swing.plaf.basic

public Class BasicComboBoxEditor

extends Object
implements ComboBoxEditor, FocusListener
Class Inheritance
All Implemented Interfaces
java.awt.event.FocusListener, java.util.EventListener, javax.swing.ComboBoxEditor
Known Direct Subclasses
javax.swing.plaf.basic.BasicComboBoxEditor.UIResource, javax.swing.plaf.metal.MetalComboBoxEditor
Imports
javax.swing.ComboBoxEditor, .JTextField, javax.swing.border.Border, java.awt.Component, java.awt.event.*, java.lang.reflect.Method, sun.reflect.misc.MethodUtil

The default editor for editable combo boxes. The editor is implemented as a JTextField.
Authors
Arnaud Weber, Mark Davidson

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
public static class
BasicComboBoxEditor.UIResource

A subclass of BasicComboBoxEditor that implements UIResource.

Field Summary

Modifier and TypeField and Description
protected JTextField
editor

An instance of JTextField.

private Object

Constructor Summary

AccessConstructor and Description
public
BasicComboBoxEditor()

Constructs a new instance of BasicComboBoxEditor.

Method Summary

Modifier and TypeMethod and Description
public void
addActionListener(ActionListener
an ActionListener
l
)

Implements javax.swing.ComboBoxEditor.addActionListener.

Add an ActionListener.
protected JTextField

Returns:

a new editor component
createEditorComponent
()

Creates the internal editor component.

public void
focusGained(FocusEvent
the event to be processed
e
)

Implements java.awt.event.FocusListener.focusGained.

Invoked when a component gains the keyboard focus.
public void
focusLost(FocusEvent
the event to be processed
e
)

Implements java.awt.event.FocusListener.focusLost.

Invoked when a component loses the keyboard focus.
public Component
getEditorComponent()

Implements javax.swing.ComboBoxEditor.getEditorComponent.

Returns the component that should be added to the tree hierarchy for this editor
public Object
getItem()

Implements javax.swing.ComboBoxEditor.getItem.

Returns the edited item
public void
removeActionListener(ActionListener
an ActionListener
l
)

Implements javax.swing.ComboBoxEditor.removeActionListener.

Remove an ActionListener
public void
selectAll()

Implements javax.swing.ComboBoxEditor.selectAll.

Ask the editor to start editing and to select everything
public void
setItem(Object
the displayed value of the editor
anObject
)

Implements javax.swing.ComboBoxEditor.setItem.

Sets the item that should be edited.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

editorback to summary
protected JTextField editor

An instance of JTextField.

oldValueback to summary
private Object oldValue

Constructor Detail

BasicComboBoxEditorback to summary
public BasicComboBoxEditor()

Constructs a new instance of BasicComboBoxEditor.

Method Detail

addActionListenerback to summary
public void addActionListener(ActionListener l)

Implements javax.swing.ComboBoxEditor.addActionListener.

Doc from javax.swing.ComboBoxEditor.addActionListener.

Add an ActionListener. An action event is generated when the edited item changes

Parameters
l:ActionListener

an ActionListener

createEditorComponentback to summary
protected JTextField createEditorComponent()

Creates the internal editor component. Override this to provide a custom implementation.

Returns:JTextField

a new editor component

Since
1.6
focusGainedback to summary
public void focusGained(FocusEvent e)

Implements java.awt.event.FocusListener.focusGained.

Doc from java.awt.event.FocusListener.focusGained.

Invoked when a component gains the keyboard focus.

Parameters
e:FocusEvent

the event to be processed

focusLostback to summary
public void focusLost(FocusEvent e)

Implements java.awt.event.FocusListener.focusLost.

Doc from java.awt.event.FocusListener.focusLost.

Invoked when a component loses the keyboard focus.

Parameters
e:FocusEvent

the event to be processed

getEditorComponentback to summary
public Component getEditorComponent()

Implements javax.swing.ComboBoxEditor.getEditorComponent.

Doc from javax.swing.ComboBoxEditor.getEditorComponent.

Returns the component that should be added to the tree hierarchy for this editor

Returns:Component

the component

getItemback to summary
public Object getItem()

Implements javax.swing.ComboBoxEditor.getItem.

Doc from javax.swing.ComboBoxEditor.getItem.

Returns the edited item

Returns:Object

the edited item

removeActionListenerback to summary
public void removeActionListener(ActionListener l)

Implements javax.swing.ComboBoxEditor.removeActionListener.

Doc from javax.swing.ComboBoxEditor.removeActionListener.

Remove an ActionListener

Parameters
l:ActionListener

an ActionListener

selectAllback to summary
public void selectAll()

Implements javax.swing.ComboBoxEditor.selectAll.

Doc from javax.swing.ComboBoxEditor.selectAll.

Ask the editor to start editing and to select everything

setItemback to summary
public void setItem(Object anObject)

Implements javax.swing.ComboBoxEditor.setItem.

Sets the item that should be edited.

Parameters
anObject:Object

the displayed value of the editor

javax.swing.plaf.basic back to summary

pack-priv Class BasicComboBoxEditor.BorderlessTextField

extends JTextField
Class Inheritance
Annotations
@SuppressWarnings:serial

Field Summary

Inherited from javax.swing.JTextField:
notifyAction

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
setBorder(Border
the border to be rendered for this component
b
)

Overrides javax.swing.JComponent.setBorder.

Sets the border of this component.
public void
setText(String
the new text to be set
s
)

Overrides javax.swing.text.JTextComponent.setText.

Sets the text of this TextComponent to the specified text.
Inherited from javax.swing.JTextField:
actionPropertyChangedaddActionListenerconfigurePropertiesFromActioncreateActionPropertyChangeListenercreateDefaultModelfireActionPerformedgetAccessibleContextgetActiongetActionListenersgetActionsgetColumnsgetColumnWidthgetHorizontalAlignmentgetHorizontalVisibilitygetPreferredSizegetScrollOffsetgetUIClassIDisValidateRootparamStringpostActionEventremoveActionListenerscrollRectToVisiblesetActionsetActionCommandsetColumnssetDocumentsetFontsetHorizontalAlignmentsetScrollOffset

Constructor Detail

BorderlessTextFieldback to summary
public BorderlessTextField(String value, int n)

Method Detail

setBorderback to summary
public void setBorder(Border b)

Overrides javax.swing.JComponent.setBorder.

Doc from javax.swing.JComponent.setBorder.

Sets the border of this component. The Border object is responsible for defining the insets for the component (overriding any insets set directly on the component) and for optionally rendering any border decorations within the bounds of those insets. Borders should be used (rather than insets) for creating both decorative and non-decorative (such as margins and padding) regions for a swing component. Compound borders can be used to nest multiple borders within a single component.

Although technically you can set the border on any object that inherits from JComponent, the look and feel implementation of many standard Swing components doesn't work well with user-set borders. In general, when you want to set a border on a standard Swing component other than JPanel or JLabel, we recommend that you put the component in a JPanel and set the border on the JPanel.

This is a bound property.

Parameters
b:Border

the border to be rendered for this component

setTextback to summary
public void setText(String s)

Overrides javax.swing.text.JTextComponent.setText.

Doc from javax.swing.text.JTextComponent.setText.

Sets the text of this TextComponent to the specified text. If the text is null or empty, has the effect of simply deleting the old text. When text has been inserted, the resulting caret location is determined by the implementation of the caret class.

Note that text is not a bound property, so no PropertyChangeEvent is fired when it changes. To listen for changes to the text, use DocumentListener.

Parameters
s:String

the new text to be set

javax.swing.plaf.basic back to summary

public Class BasicComboBoxEditor.UIResource

extends BasicComboBoxEditor
implements UIResource
Class Inheritance
All Implemented Interfaces
javax.swing.plaf.UIResource
Known Direct Subclasses
javax.swing.plaf.synth.SynthComboBoxUI.SynthComboBoxEditor
Annotations
@SuppressWarnings:serial

A subclass of BasicComboBoxEditor that implements UIResource. BasicComboBoxEditor doesn't implement UIResource directly so that applications can safely override the cellRenderer property with BasicListCellRenderer subclasses.

Warning

Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans has been added to the java.beans package. Please see java.beans.XMLEncoder.

Field Summary

Inherited from javax.swing.plaf.basic.BasicComboBoxEditor:
editor

Constructor Summary

AccessConstructor and Description
public
UIResource()

Constructs a UIResource.

Method Summary

Inherited from javax.swing.plaf.basic.BasicComboBoxEditor:
addActionListenercreateEditorComponentfocusGainedfocusLostgetEditorComponentgetItemremoveActionListenerselectAllsetItem

Constructor Detail

UIResourceback to summary
public UIResource()

Constructs a UIResource.