[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: BasicComboBoxEditor
From: |
David Gilbert |
Subject: |
[cp-patches] FYI: BasicComboBoxEditor |
Date: |
Mon, 07 Nov 2005 11:32:41 +0000 |
User-agent: |
Mozilla Thunderbird 1.0.7 (X11/20051026) |
This patch fixes some failing Mauve tests and tidies up some of the API docs for the
BasicComboBoxEditor class. It is also the first step towards fixing a layout bug
for editable JComboBoxes (more to follow later):
2005-11-07 David Gilbert <address@hidden>
* javax/swing/plaf/basic/BasicComboBoxEditor.java: API docs plus
(BasicComboBoxEditor): set border to null and columns to 9,
(addActionListener): implemented,
(removeActionListener): implemented.
Regards,
Dave
Index: javax/swing/plaf/basic/BasicComboBoxEditor.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java,v
retrieving revision 1.7
diff -u -r1.7 BasicComboBoxEditor.java
--- javax/swing/plaf/basic/BasicComboBoxEditor.java 18 Oct 2005 22:10:32
-0000 1.7
+++ javax/swing/plaf/basic/BasicComboBoxEditor.java 7 Nov 2005 11:05:06
-0000
@@ -45,35 +45,34 @@
import javax.swing.ComboBoxEditor;
import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
/**
- * This is a component that is responsible for displaying/editting selected
- * item in comboBox. By default, the JTextField is returned as
- * BasicComboBoxEditor.
+ * An editor used by the address@hidden BasicComboBoxUI} class. This editor
uses a
+ * address@hidden JTextField} as the editor component.
*
* @author Olga Rodimina
*/
public class BasicComboBoxEditor extends Object implements ComboBoxEditor,
FocusListener
{
+ /** The editor component. */
protected JTextField editor;
/**
- * Creates a new BasicComboBoxEditor object.
+ * Creates a new <code>BasicComboBoxEditor</code> instance.
*/
public BasicComboBoxEditor()
{
editor = new JTextField();
- editor.setBorder(new EmptyBorder(1, 1, 1, 1));
+ editor.setBorder(null);
+ editor.setColumns(9);
}
/**
- * This method returns textfield that will be used by the combo box to
- * display/edit currently selected item in the combo box.
+ * Returns the component that will be used by the combo box to display and
+ * edit the currently selected item in the combo box.
*
- * @return textfield that will be used by the combo box to display/edit
- * currently selected item
+ * @return The editor component, which is a address@hidden JTextField} in
this case.
*/
public Component getEditorComponent()
{
@@ -98,15 +97,18 @@
}
/**
- * This method returns item that is currently editable.
+ * Returns the text from the editor component.
*
- * @return item in the combo box that is currently editable
+ * @return The text from the editor component.
*/
public Object getItem()
{
return editor.getText();
}
+ /**
+ * Selects all the text in the editor component.
+ */
public void selectAll()
{
editor.selectAll();
@@ -136,8 +138,8 @@
}
/**
- * This method adds actionListener to the editor. If the user will edit
- * currently selected item in the textfield and pressEnter, then action
+ * Adds an address@hidden ActionListener} to the editor component. If the
user will
+ * edit currently selected item in the textfield and pressEnter, then action
* will be performed. The actionPerformed of this ActionListener should
* change the selected item of the comboBox to the newly editted selected
* item.
@@ -147,24 +149,28 @@
*/
public void addActionListener(ActionListener l)
{
- // FIXME: Need to implement
+ editor.addActionListener(l);
}
/**
- * This method removes actionListener from the textfield.
+ * Removes the address@hidden ActionListener} from the editor component.
*
- * @param l the ActionListener to remove from the textfield.
+ * @param l the listener to remove.
*/
public void removeActionListener(ActionListener l)
{
- // FIXME: Need to implement
+ editor.removeActionListener(l);
}
+ /**
+ * A subclass of address@hidden BasicComboBoxEditor} that implements the
+ * address@hidden UIResource} interface.
+ */
public static class UIResource extends BasicComboBoxEditor
implements javax.swing.plaf.UIResource
{
/**
- * Creates a new UIResource object.
+ * Creates a new <code>BasicComboBoxEditor.UIResource</code> instance.
*/
public UIResource()
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: BasicComboBoxEditor,
David Gilbert <=