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

motif awt's CheckBox.setLabel doesn't always work

XMLWordPrintable

    • sparc
    • solaris_2.5

      If you create an awt Checkbox with the constructor that takes no arguments, and after it's been created, set its label with setLabel, the label won't be set correctly.

      Here's sample code that demonstrates the problem:

      import java.awt.*;

      public class BadCheckbox extends Frame
      {
      public static void main(String args[])
      {
      BadCheckbox f = new BadCheckbox();
      f.pack();
      f.show();
      f.changelabel();
      }

      Checkbox goodcheck, badcheck;
      public BadCheckbox()
      {
      super("Bad check box demo");
      goodcheck = new Checkbox("Fred");
      add("North",goodcheck);
      badcheck = new Checkbox();
      add("South",badcheck);
      }
      public void changelabel()
      {
      goodcheck.setLabel("Good");
      badcheck.setLabel("Bad");
      }
      }

            rramsunw Ranganathan Ram (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: