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

GraphicsEnvironment.getFontMetrics() throws java.lang.InternalError

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5

      Description



      Name: akC57697 Date: 03/12/98



      The java.awt.GraphicsEnvironment.getFontMetrics(Font) does not work properly
      under Solaris and Windows95.
      It throws java.lang.InternalError: java/langNullPointerException


      -----------------------Example--------------------
      import java.awt.swing.SwingUtilities;
      import java.awt.Toolkit;
      import java.awt.FontMetrics;
      import java.awt.Font;
      import java.awt.GraphicsEnvironment;

      public class GraphicsEnvironmentTest {
          public static void main(String s[]) {
          
            Font fonts [] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
            FontMetrics fm = null;

           for (int ff=0;ff<fonts.length;ff++) { // Try all fonts
            fm = Toolkit.getDefaultToolkit().getFontMetrics(fonts[ff]);
           }

        }
      }

      --------------------------------------------------
      Output:
      java.lang.InternalError: java/langNullPointerException
      at sun.awt.motif.X11FontMetrics.init(Native Method)
      at sun.awt.motif.X11FontMetrics.<init>(X11FontMetrics.java:102)
      at sun.awt.motif.X11FontMetrics.getFontMetrics(X11FontMetrics.java:208)
      at sun.awt.motif.MToolkit.getFontMetrics(MToolkit.java:227)
      at GraphicsEnvironmentTest.main(GraphicsEnvironmentTest.java:14)
      ^C

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

        Attachments

          Activity

            People

            Assignee:
            duke J. Duke (Inactive)
            Reporter:
            akuzminorcl Alexander Kuzmin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: