-
Bug
-
Resolution: Fixed
-
P4
-
5.0
-
tiger
-
generic
-
generic
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);
}
}
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);
}
}
- relates to
-
JDK-7171412 awt Choice doesn't fire ItemStateChange when selecting item after select() call
-
- Closed
-