[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] Fixing item event management in JComboBox
From: |
Meskauskas Audrius |
Subject: |
[cp-patches] Fixing item event management in JComboBox |
Date: |
Sun, 27 Feb 2005 17:27:56 +0100 |
When changing a selected item, JComboBox always fires two item events. The
first is the deselection event, notifying, that the previously selected item
is no longer selected. Next follows the selection event, notifying about the
currently selected item.
The Mauve test on the events indicates that the Classpath version does not
fire the deselection event when selecting the item first time after calling
the constructor. If the JCheckbox is constructed from array or vector of
items, the first item is selected by default, and the the item listeners
must be notified that it is deselected.
After focusing on this, I found another bug: after creating JComboBox from
the array of items, the getSelectedIndex returns -1 (none selected). If the
array is not empty, it must return 0, the index of the first item, selected
by default.
The bug can be fixed by adding setSelectedIndex(0) in the two constructors.
Audrius Meskauskas
JComboBox.java.diff
Description: Binary data
- [cp-patches] Fixing item event management in JComboBox,
Meskauskas Audrius <=