XAWT: Selecting current item in a Choice should send ItemEvent

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 5.0
    • Affects Version/s: 5.0
    • Component/s: client-libs
    • 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);
              }
      }

            Assignee:
            Brent Christian
            Reporter:
            Brent Christian
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: