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

Choice/List font bug

XMLWordPrintable

    • x86
    • windows_nt



      Name: chT40241 Date: 12/05/97


      Compile and run the following program. Note that the List and Choice item cells are not large enough to hold the set font. This happens anytime the font is set after the peer has been created. If you move the setVisible call after the setFont calls, the List and Choice display properly. However, we need the ability to change the font of a component on the fly at runtime. There is no workaround; BTW the MS VM works as needed.

      import java.awt.*;
      public class bug {
         public static void main( String[] args) {
            Frame frame = new Frame();
            frame.setLayout( new FlowLayout() );
            Choice choice = new Choice();
            choice.add("One");
            choice.add("Two");
            choice.add("Three");
            choice.add("Four");
            frame.add(choice);
            List list = new List();
            list.add("One");
            list.add("Two");
            list.add("Three");
            list.add("Four");
            frame.add(list);
            frame.setVisible(true); // this method call
            Font font = new Font("Dialog", Font.PLAIN, 24);
            choice.setFont(font);
            list.setFont(font);
            //frame.setVisible(true);
         }
      }

      ======================================================================

            jlockesunw Jonathan Locke (Inactive)
            chickeysunw Chuck Hickey (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: