Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6476183

PIT. Drop down of a Choice changed to enabled state has a disabled like appearance

    XMLWordPrintable

Details

    • b03
    • generic
    • generic
    • Not verified

    Description

      This is reproducible with dolphin b02 PIT build. Not reproducible with mustang b98. Reproducible only on Linux and Solaris platforms.

      I've a checkbox and a choice on a frame. The choice is initially disabled. It becomes enabled when checkbox is selected. After making the choice enabled, I click the choice to make the drop down visible. I drag the scollbar on the drop down. When the scrollbar is dragged, the drop down changes to a disabled-like appearance.

      To reproduce:
      1. Run the code below
      2. Click the 'Select' checkbox, the choice becomes enabled
      3. Click the choice to show the drop down
      4. Drag the scrollbar. If the items in the drop down becomes disabled-like, bug is reproduced.

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

      public class ChoiceTest {
          
          private static Choice ch;
          
          public static void main(String[] args) {
              Frame f = new Frame();
              f.setSize(200, 200);
              f.setLayout(new FlowLayout());
              Checkbox cb = new Checkbox("Select");
              ch = new Choice();
              ch.setEnabled(false);
              for (int i = 0; i < 15; i++) {
                  ch.addItem("Item" + i);
              }
              cb.addItemListener(new ItemListener() {
                  public void itemStateChanged(ItemEvent event) {
                      if (event.getStateChange() == ItemEvent.SELECTED) {
                          ch.setEnabled(true);
                      } else {
                          ch.setEnabled(false);
                      }
                  }
              });
              f.add(cb);
              f.add(ch);
              f.setVisible(true);
          }
      }

      Attachments

        Activity

          People

            dav Andrei Dmitriev (Inactive)
            gramachasunw Girish Ramachandran (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: