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

getFont() seems to always return null

XMLWordPrintable

    • sparc
    • generic

      I'm trying to slightly enlarge the default font, whatever it is.
      This is quite possibly bogus, but anyway....

      No matter where I do a getFont(), it returns null. I've tried
      it in the init(), start(), and main() methods of my application
      (which theoretically could also run as an applet).

      public class GUI extends Applet { . . .
          public static void main(String args[]) {
              Frame f = new Frame("GUI");
              GUI gui = new GUI();
              gui.init();
              gui.start();
       
              Font oldFont = gui.getFont();
              if (oldFont == null) {
                  System.out.println("Eek! font is null!");
              } else {
                  gui.setFont(new Font(oldFont.getFamily(), oldFont.getStyle(),
                              oldFont.getSize()+2));
              }
       . . .

            sshaiosunw Sami Shaio (Inactive)
            kwalrathsunw Kathy Walrath (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: