I implemented a JComboBox method that was marked as stub.
2006-04-05 Roman Kennke <[EMAIL PROTECTED]>
* javax/swing/JComboBox.java
(selectWithKeyChar): Implemented stubbed method.
/Roman
Index: javax/swing/JComboBox.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JComboBox.java,v
retrieving revision 1.26
diff -u -1 -0 -r1.26 JComboBox.java
--- javax/swing/JComboBox.java 23 Mar 2006 10:42:30 -0000 1.26
+++ javax/swing/JComboBox.java 5 Apr 2006 15:19:07 -0000
@@ -31,22 +31,20 @@
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.swing;
-import gnu.classpath.NotImplementedException;
-
import java.awt.ItemSelectable;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Vector;
@@ -937,24 +935,34 @@
* specified keyChar and returns true if such item is found. Otherwise
* false is returned.
*
* @param keyChar character indicating which item in the combo box should be
* selected.
*
* @return boolean true if item corresponding to the specified keyChar
* exists in the combo box. Otherwise false is returned.
*/
public boolean selectWithKeyChar(char keyChar)
- throws NotImplementedException
{
- // FIXME: Need to implement
- return false;
+ if (keySelectionManager == null)
+ {
+ keySelectionManager = createDefaultKeySelectionManager();
+ }
+
+ int index = keySelectionManager.selectionForKey(keyChar, getModel());
+ boolean retVal = false;
+ if (index >= 0)
+ {
+ setSelectedIndex(index);
+ retVal = true;
+ }
+ return retVal;
}
/**
* The part of implementation of ListDataListener interface. This method is
* invoked when some items where added to the JComboBox's data model.
*
* @param event ListDataEvent describing the change
*/
public void intervalAdded(ListDataEvent event)
{