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

XAWT loads more Swing classes than necessary for a simple Frame test

XMLWordPrintable

    • b27
    • x86
    • linux

      I noticed that when running a minimal Frame test with -verbose:class that under XAWT, over 60 Swing classes are loaded. It would be reasonable to see a few, as XAWT makes use of the MotifLookAndFeel, but there are also Metal and Ocean classes being loaded - I don't think these are needed to show an emtpy Frame. I've attached the classlist. For reference, my test case is:

      import java.awt.*;
      import java.awt.event.*;

      public class MinTest extends Frame {
      public MinTest() {
      super("MinTest");
              addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {
                      System.exit(0);
                  }
              });
      }

      public void paint(Graphics g) {
      System.out.println("paint()");
      }

      public static void main(String[] args) {
      MinTest f = new MinTest();
      f.setSize(400, 400);
      f.setVisible(true);
      }
      }

      This isn't an urgent bug, as even a modest Swing app is likely to need many if not all of the loaded classes anyway. But it would be interesting to know what's causing the classloads - perhaps there's a small optimization that could be made.


            dmikhalksunw Denis Mikhalkin (Inactive)
            bchristi Brent Christian
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: