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

Default fonts are different in graphics objects

XMLWordPrintable

    • 1.0.2
    • sparc
    • solaris_2.4
    • Verified

      import java.awt.*;

      public class FontTest extends java.applet.Applet {
          String str;
         
         public void init() {
           repaint();
          }

         public void paint(Graphics g) {
      Dimension d = size();
      Image screen = createImage(d.width, d.height / 2);
      Graphics ng = screen.getGraphics();
      ng.setColor(Color.black);
      ng.drawString("using Graphics object of the image", 50, d.height / 4);
      g.drawImage(screen, 0, 0, null);
      g.setColor(Color.black);
      g.drawString("using Graphics object from the paint Method"
      , 50, (d.height / 2) + 20);
          }
      }


      both strings are printed with different fonts.

            flar Jim Graham
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: