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

Dragged out applets need hook for translucency support on X11 platforms

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 6u10
    • deploy
    • generic
    • generic

      In order to achieve portable support of translucent applets dragged out of the browser, we need to add another hook,

        public GraphicsConfiguration getDraggedAppletGraphicsConfiguration()

      or similar, which will be called only on X11 platforms and which the applet can customize to decide which GraphicsConfiguration to use for the created Frame / JFrame. Here is sample code from ###@###.### for this purpose:

            GraphicsConfiguration gc = null;
              if (AWTUtilities.isTranslucencySupported(PERPIXEL_TRANSLUCENT)) {
                  gc = findGraphicsConfig();
              }
              if (gc == null) {
                 // translucent windows are not supported
                 gc = // default config
              }
              JFrame = new JFrame(gc);
              // and so on

          private GraphicsConfiguration findGraphicsConfig() {
              GraphicsDevice gd =
                  GraphicsEnvironment.getLocalGraphicsEnvironment().
                      getDefaultScreenDevice();
              GraphicsConfiguration gcs[] = gd.getConfigurations();
              for (GraphicsConfiguration gc : gcs) {
                  if (AWTUtilities.isTranslucencyCapable(gc)) {
                      return gc;
                  }
              }
              return null;
          }

            herrick Andy Herrick (Inactive)
            kbr Kenneth Russell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: