-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
1.1.5, 1.2.0, 1.4.1
-
Fix Understood
-
generic, x86, sparc
-
generic, solaris_2.5.1, windows_95, windows_xp
Name: clC74495 Date: 10/13/98
It seems like DefaultComboBoxModel should have several methods
found in DefaultListModel to deal with the internal data structure.
While there are more, the following are the ones that I would REALLY
like to see.
Please please....
capacity()
ensureCapacity()
setSize()
toArray()
trimToSize()
(Review ID: 40298)
======================================================================
Name: diC59631 Date: 10/15/98
I am using Swing 1.1 beta2, and also checked
the docs on your web site.
DefaultComboBoxModel does not have a "contains"
method, but DefaultListModel does. It would
be convenient and more symmetric to have a
"contains" method in DefaultComboBoxModel.
(Review ID: 40472)
======================================================================
Name: jk109818 Date: 04/03/2003
FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
A DESCRIPTION OF THE PROBLEM :
DefaultComboBoxModel and DefaultListModel have nearly the
same underlying implementation but DefaultListModel provides
a significantly richer API. These additional methods in
DefaultListModel make it easier to understand as it is
similar to the Collection interface and easier to use due to
numerous convenience methods. DefaultComboBoxModel should
support the same list of methods as DefaultListModel.
The methods that would have to be added to
DefaultComboBoxModel are:
void add(int index, Object element)
Inserts the specified element at the specified position in
this list.
int capacity()
Returns the current capacity of this list.
boolean contains(Object elem)
Tests whether the specified object is a component in this list.
void copyInto(Object[] anArray)
Copies the components of this list into the specified array.
Enumeration elements()
Returns an enumeration of the components of this list.
void ensureCapacity(int minCapacity)
Increases the capacity of this list, if necessary, to ensure
that it can hold at least the number of components specified
by the minimum capacity argument.
Object firstElement()
Returns the first component of this list.
boolean isEmpty()
Tests whether this list has any components.
Object lastElement()
Returns the last component of the list.
int lastIndexOf(Object elem)
Returns the index of the last occurrence of elem.
int lastIndexOf(Object elem, int index)
Searches backwards for elem, starting from the specified
index, and returns an index to it.
void removeRange(int fromIndex, int toIndex)
Deletes the components at the specified range of indexes.
Object set(int index, Object element)
Replaces the element at the specified position in this list
with the specified element.
void setElementAt(Object obj, int index)
Sets the component at the specified index of this list to be
the specified object.
void setSize(int newSize)
Sets the size of this list.
Object[] toArray()
Returns an array containing all of the elements in this list
in the correct order.
void trimToSize()
Trims the capacity of this list to be the list's current size.
The following methods would not add new functionality but
would provide naming consistency:
void clear()
Removes all of the elements from this list.
Object get(int index)
Returns the element at the specified position in this list.
int indexOf(Object elem)
Searches for the first occurrence of elem.
Object remove(int index)
Removes the element at the specified position in this list.
REPRODUCIBILITY :
This bug can be reproduced always.
(Review ID: 181292)
======================================================================
It seems like DefaultComboBoxModel should have several methods
found in DefaultListModel to deal with the internal data structure.
While there are more, the following are the ones that I would REALLY
like to see.
Please please....
capacity()
ensureCapacity()
setSize()
toArray()
trimToSize()
(Review ID: 40298)
======================================================================
Name: diC59631 Date: 10/15/98
I am using Swing 1.1 beta2, and also checked
the docs on your web site.
DefaultComboBoxModel does not have a "contains"
method, but DefaultListModel does. It would
be convenient and more symmetric to have a
"contains" method in DefaultComboBoxModel.
(Review ID: 40472)
======================================================================
Name: jk109818 Date: 04/03/2003
FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
A DESCRIPTION OF THE PROBLEM :
DefaultComboBoxModel and DefaultListModel have nearly the
same underlying implementation but DefaultListModel provides
a significantly richer API. These additional methods in
DefaultListModel make it easier to understand as it is
similar to the Collection interface and easier to use due to
numerous convenience methods. DefaultComboBoxModel should
support the same list of methods as DefaultListModel.
The methods that would have to be added to
DefaultComboBoxModel are:
void add(int index, Object element)
Inserts the specified element at the specified position in
this list.
int capacity()
Returns the current capacity of this list.
boolean contains(Object elem)
Tests whether the specified object is a component in this list.
void copyInto(Object[] anArray)
Copies the components of this list into the specified array.
Enumeration elements()
Returns an enumeration of the components of this list.
void ensureCapacity(int minCapacity)
Increases the capacity of this list, if necessary, to ensure
that it can hold at least the number of components specified
by the minimum capacity argument.
Object firstElement()
Returns the first component of this list.
boolean isEmpty()
Tests whether this list has any components.
Object lastElement()
Returns the last component of the list.
int lastIndexOf(Object elem)
Returns the index of the last occurrence of elem.
int lastIndexOf(Object elem, int index)
Searches backwards for elem, starting from the specified
index, and returns an index to it.
void removeRange(int fromIndex, int toIndex)
Deletes the components at the specified range of indexes.
Object set(int index, Object element)
Replaces the element at the specified position in this list
with the specified element.
void setElementAt(Object obj, int index)
Sets the component at the specified index of this list to be
the specified object.
void setSize(int newSize)
Sets the size of this list.
Object[] toArray()
Returns an array containing all of the elements in this list
in the correct order.
void trimToSize()
Trims the capacity of this list to be the list's current size.
The following methods would not add new functionality but
would provide naming consistency:
void clear()
Removes all of the elements from this list.
Object get(int index)
Returns the element at the specified position in this list.
int indexOf(Object elem)
Searches for the first occurrence of elem.
Object remove(int index)
Removes the element at the specified position in this list.
REPRODUCIBILITY :
This bug can be reproduced always.
(Review ID: 181292)
======================================================================
- duplicates
-
JDK-4181643 DefaultComboBoxModel does not have a "contains()" method.
-
- Closed
-
-
JDK-4199578 DefaultComboBoxModel: inconsistency between addElement/insertElementAt
-
- Closed
-