/[classpath]/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2.2.5 by gnu_andrew, Wed Nov 2 00:43:52 2005 UTC revision 1.2.2.6 by gnu_andrew, Sun Nov 27 21:00:38 2005 UTC
# Line 45  import java.awt.event.FocusListener; Line 45  import java.awt.event.FocusListener;
45    
46  import javax.swing.ComboBoxEditor;  import javax.swing.ComboBoxEditor;
47  import javax.swing.JTextField;  import javax.swing.JTextField;
 import javax.swing.border.EmptyBorder;  
48    
49  /**  /**
50   * This is a component that is responsible for displaying/editting  selected   * An editor used by the {@link BasicComboBoxUI} class.  This editor uses a
51   * item in comboBox. By default, the  JTextField is returned as   * {@link JTextField} as the editor component.
  * BasicComboBoxEditor.  
52   *   *
53   * @author Olga Rodimina   * @author Olga Rodimina
54   */   */
55  public class BasicComboBoxEditor extends Object implements ComboBoxEditor,  public class BasicComboBoxEditor extends Object implements ComboBoxEditor,
56                                                             FocusListener                                                             FocusListener
57  {  {
58      /** The editor component. */
59    protected JTextField editor;    protected JTextField editor;
60    
61    /**    /**
62     * Creates a new BasicComboBoxEditor object.     * Creates a new <code>BasicComboBoxEditor</code> instance.
63     */     */
64    public BasicComboBoxEditor()    public BasicComboBoxEditor()
65    {    {
66      editor = new JTextField();      editor = new JTextField();
67      editor.setBorder(new EmptyBorder(1, 1, 1, 1));      editor.setBorder(null);
68        editor.setColumns(9);
69    }    }
70    
71    /**    /**
72     * This method returns textfield that will be used by the combo  box to     * Returns the component that will be used by the combo box to display and
73     * display/edit currently selected item in the combo box.     * edit the currently selected item in the combo box.
74     *     *
75     * @return textfield that will be used by the combo box to  display/edit     * @return The editor component, which is a {@link JTextField} in this case.
    *         currently selected item  
76     */     */
77    public Component getEditorComponent()    public Component getEditorComponent()
78    {    {
# Line 98  public class BasicComboBoxEditor extends Line 97  public class BasicComboBoxEditor extends
97    }    }
98    
99    /**    /**
100     * This method returns item that is currently editable.     * Returns the text from the editor component.
101     *     *
102     * @return item in the combo box that is currently editable     * @return The text from the editor component.
103     */     */
104    public Object getItem()    public Object getItem()
105    {    {
106      return editor.getText();      return editor.getText();
107    }    }
108    
109      /**
110       * Selects all the text in the editor component.
111       */
112    public void selectAll()    public void selectAll()
113    {    {
114      editor.selectAll();      editor.selectAll();
# Line 136  public class BasicComboBoxEditor extends Line 138  public class BasicComboBoxEditor extends
138    }    }
139    
140    /**    /**
141     * This method adds actionListener to the editor. If the user will edit     * Adds an {@link ActionListener} to the editor component.  If the user will
142     * currently selected item in the textfield and pressEnter, then action     * edit currently selected item in the textfield and pressEnter, then action
143     * will be performed. The actionPerformed of this ActionListener should     * will be performed. The actionPerformed of this ActionListener should
144     * change the selected item of the comboBox to the newly editted  selected     * change the selected item of the comboBox to the newly editted  selected
145     * item.     * item.
# Line 147  public class BasicComboBoxEditor extends Line 149  public class BasicComboBoxEditor extends
149     */     */
150    public void addActionListener(ActionListener l)    public void addActionListener(ActionListener l)
151    {    {
152      // FIXME: Need to implement      editor.addActionListener(l);
153    }    }
154    
155    /**    /**
156     * This method removes actionListener from the textfield.     * Removes the {@link ActionListener} from the editor component.
157     *     *
158     * @param l the ActionListener to remove from the textfield.     * @param l the listener to remove.
159     */     */
160    public void removeActionListener(ActionListener l)    public void removeActionListener(ActionListener l)
161    {    {
162      // FIXME: Need to implement      editor.removeActionListener(l);
163    }    }
164    
165      /**
166       * A subclass of {@link BasicComboBoxEditor} that implements the
167       * {@link UIResource} interface.
168       */
169    public static class UIResource extends BasicComboBoxEditor    public static class UIResource extends BasicComboBoxEditor
170      implements javax.swing.plaf.UIResource      implements javax.swing.plaf.UIResource
171    {    {
172      /**      /**
173       * Creates a new UIResource object.       * Creates a new <code>BasicComboBoxEditor.UIResource</code> instance.
174       */       */
175      public UIResource()      public UIResource()
176      {      {

Legend:
Removed from v.1.2.2.5  
changed lines
  Added in v.1.2.2.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26