-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.1
-
x86
-
windows_2000
Name: jk109818 Date: 09/16/2002
FULL PRODUCT VERSION :
On win2K: JDK 1.4.1-rc-b19
On linux: JDK 1.4.1-rc-b19
On embedix linux: Jeode EVM Version 1.10.2, Personal Java 1.2
FULL OPERATING SYSTEM VERSION :
- Microsoft Windows 2000 [Version 5.00.2195]
ADDITIONAL OPERATING SYSTEMS :
- Linux 2.4.19 with KDE2
- Linux 2.4.6-rmk1-np2-embedix with Qtopia (Sharp Zaurus)
- Symbian EPOC (Nokia 9200 Communicator)
A DESCRIPTION OF THE PROBLEM :
An AWT List has multiple selection enabled. Sequences of
ItemEvent sent to a listener are different between plaforms.
It should be identical as ItemEvent is a semantic event.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the test program on different platforms.
2. Try for instance the following actions:
a) Select an item in the list
b) Using cursor keys, move the focus to another item.
c) Deselect an already selected item.
EXPECTED VERSUS ACTUAL BEHAVIOR :
1) itemStateChanged() on the listener should be called only
when the state of an item change (not when it gains focus
but does not change selection state).
2) Sequence of events sent should be the same between
platforms, for a similar sequence of selection/deselection.
For the listed platforms, here are the results obtained:
[1] Linux with KDE2, Sun JDK 1.4.1-rc-b19
I have what I expect:
a) Item selected event
b) No item selection events while focus change
c) Item deselected event
[2] Windows 2000 SP2 Sun JDK 1.4.1-rc-b19
Strange results, but usable:
a) Item selected event
b) The state of the element where the cursor is is
sent, even if the state of item does not change. If the
focus goes to a non-selected element, I receive a
deselected event.
c) Item deselected event received.
So, focus move in the list generates item selection
events...
[3] Sharp Zaurus Jeode
Buggy results:
a) Item selected event
b) All elements where the cursor goes are selected and
I receive "item selected" events
c) No event is received, so we can't know when an item
is deselected.
This behavior is buggy as there is no way to know when
deselection occurs.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
/**
* Test behavor of lists with multiple selection.
*
* @author Pierre MM- tras
* @created 15 septembre 2002
*/
class Multiselect
extends Frame
{
List _listEvents;
/**
* Create a new window with a List
*
* @param title The title of the window.
*/
Multiselect(final String title)
{
super(title);
setSize(200, 250);
setLocation(0, 0);
setLayout(new BorderLayout());
Label label = new Label("Top list has multiselection");
add(label, BorderLayout.NORTH);
List multilist = new List(10);
multilist.setMultipleMode(true);
for (int i = 0; i < 100; i++)
{
multilist.add("Element " + i);
}
add(multilist, BorderLayout.CENTER);
_listEvents = new List(10);
add(_listEvents, BorderLayout.SOUTH);
addWindowListener(
new WindowAdapter()
{
public void windowClosing(final WindowEvent evt)
{
System.exit(0);
}
});
multilist.addItemListener(
new ItemListener()
{
public void itemStateChanged(final ItemEvent
evt)
{
_listEvents.add("Item " +
evt.getItem() + ": " + ((evt.getStateChange() ==
ItemEvent.SELECTED) ? "Selected" : "Deselected"));
_listEvents.makeVisible
(_listEvents.getItemCount() - 1);
}
});
validate();
show();
}
/**
* The main program for the Multiselect class
*
* @param args The command line arguments
*/
public static void main(String[] args)
{
new Multiselect("Test of multiselection");
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
On Win2K, filter events as extra events are sent.
On the Sharp Zaurus, no work around is possible as
deselection events are not sent.
(Review ID: 164515)
======================================================================
- duplicates
-
JDK-6191379 Navigating through items on multi-selection list triggers ItemEvent on win32
- Closed