JDK-4902933 : XAWT: Selecting current item in a Choice should send ItemEvent
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2003-08-07
  • Updated: 2012-10-08
  • Resolved: 2003-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
Related Reports
Relates :  
Description
On Windows and Solaris (MToolkit), when you pop down a Choice and select the currently selected item, an ItemEvent is sent to the ItemListeners.  This is not true with XAWT.  While it may make more sense (the currentely selected item doesn't technically undergo a state change when it is selected again), it is a change from previous behavior.

import java.awt.*;
import java.awt.event.*;

public class LongChoice {
        public static void main(String[] args) {
                Frame f = new Frame("LongChoice");
                Choice c = new Choice();
                for (int loop = 0; loop < 100; loop++) {
                        c.addItem("Item " + loop);
                }
                c.addItemListener(new ItemListener() {
                        public void itemStateChanged(ItemEvent e) {
                                System.out.println("itemStateChanged");
                        }
                });
                f.add(c);
                f.setSize(200,200);
                f.setVisible(true);
        }
}

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b19
14-06-2004

EVALUATION This behavior was specifically coded, but needs to be changed to match the other platforms. Another behavioral difference with MToolkit is that if a drag over an unfurled Choice ends outside of the Choice, the selection should not change and no event should be sent. ###@###.### 2003-08-07
07-08-2003