This code at the end of this post is right out of the Java docs for 
java.awt.GraphicsConfiguration.

This loop takes like 10 seconds on my Sony laptop (2.8Gz, 1 GB RAM).  I have an 
external monitor hooked up to it, so there are two devices, and each one takes 
5 seconds to get the configurations.

A colleague of mine as a much newer Compaq with an ATI video card (my Sony has 
an NVidia) and gets a bit better performance, but it still takes around 4 
seconds total.

The call to gd.getConfigurations() is a killer.  There are some bugs reported 
against this being slow, but they are old and reported as fixed.

Is this really fixed...is it supposed to take this long?

      Rectangle virtualBounds = new Rectangle();
      GraphicsEnvironment ge = GraphicsEnvironment.
              getLocalGraphicsEnvironment();
      GraphicsDevice[] gs =
              ge.getScreenDevices();
      for (int j = 0; j < gs.length; j++) {
          GraphicsDevice gd = gs[j];
          GraphicsConfiguration[] gc =
              gd.getConfigurations();
          for (int i=0; i < gc.length; i++) {
              virtualBounds =
                  virtualBounds.union(gc[i].getBounds());
          }
      }
[Message sent by forum member 'mmclaassen' (mmclaassen)]

http://forums.java.net/jive/thread.jspa?messageID=130648

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to