[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] Fixing item event management in JComboBox
From: |
Michael Koch |
Subject: |
Re: [cp-patches] Fixing item event management in JComboBox |
Date: |
Sun, 27 Feb 2005 18:09:26 +0100 |
User-agent: |
mutt-ng 1.5.8i (Debian) |
On Sun, Feb 27, 2005 at 05:27:56PM +0100, Meskauskas Audrius wrote:
> 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.
Thanks, please commit.
Michael
--
Java Trap: http://www.gnu.org/philosophy/java-trap.html