jdk/src/share/classes/java/awt/GraphicsDevice.java
changeset 2648 aa45a227fce3
parent 2451 597df8e1d786
child 2759 a6629ca69b70
equal deleted inserted replaced
2647:ea80a312972e 2648:aa45a227fce3
   110      * Device is an image buffer.  This buffer can reside in device
   110      * Device is an image buffer.  This buffer can reside in device
   111      * or system memory but it is not physically viewable by the user.
   111      * or system memory but it is not physically viewable by the user.
   112      */
   112      */
   113     public final static int TYPE_IMAGE_BUFFER           = 2;
   113     public final static int TYPE_IMAGE_BUFFER           = 2;
   114 
   114 
   115     /** Kinds of translucency supported by the underlying system.
   115     /**
   116      *  @see #isTranslucencySupported
   116      * Kinds of translucency supported by the underlying system.
   117      */
   117      *
   118     /*public */static enum WindowTranslucency {
   118      * @see #isWindowTranslucencySupported
       
   119      *
       
   120      * @since 1.7
       
   121      */
       
   122     public static enum WindowTranslucency {
   119         /**
   123         /**
   120          * Represents support in the underlying system for windows each pixel
   124          * Represents support in the underlying system for windows each pixel
   121          * of which is guaranteed to be either completely opaque, with
   125          * of which is guaranteed to be either completely opaque, with
   122          * an alpha value of 1.0, or completely transparent, with an alpha
   126          * an alpha value of 1.0, or completely transparent, with an alpha
   123          * value of 0.0.
   127          * value of 0.0.
   244      * <p>
   248      * <p>
   245      * When entering full-screen mode, if the window to be used as the
   249      * When entering full-screen mode, if the window to be used as the
   246      * full-screen window is not visible, this method will make it visible.
   250      * full-screen window is not visible, this method will make it visible.
   247      * It will remain visible when returning to windowed mode.
   251      * It will remain visible when returning to windowed mode.
   248      * <p>
   252      * <p>
   249      * When returning to windowed mode from an exclusive full-screen window, any
   253      * When entering full-screen mode, all the translucency effects are reset for
   250      * display changes made by calling <code>setDisplayMode</code> are
   254      * the window. Its shape is set to {@code null}, the opacity value is set to
       
   255      * 1.0f, and the background color alpha is set to 255 (completely opaque).
       
   256      * These values are not restored when returning to windowed mode.
       
   257      * <p>
       
   258      * When returning to windowed mode from an exclusive full-screen window,
       
   259      * any display changes made by calling {@code setDisplayMode} are
   251      * automatically restored to their original state.
   260      * automatically restored to their original state.
   252      *
   261      *
   253      * @param w a window to use as the full-screen window; <code>null</code>
   262      * @param w a window to use as the full-screen window; {@code null}
   254      * if returning to windowed mode.  Some platforms expect the
   263      * if returning to windowed mode.  Some platforms expect the
   255      * fullscreen window to be a top-level component (i.e., a Frame);
   264      * fullscreen window to be a top-level component (i.e., a Frame);
   256      * therefore it is preferable to use a Frame here rather than a
   265      * therefore it is preferable to use a Frame here rather than a
   257      * Window.
   266      * Window.
       
   267      *
   258      * @see #isFullScreenSupported
   268      * @see #isFullScreenSupported
   259      * @see #getFullScreenWindow
   269      * @see #getFullScreenWindow
   260      * @see #setDisplayMode
   270      * @see #setDisplayMode
   261      * @see Component#enableInputMethods
   271      * @see Component#enableInputMethods
   262      * @see Component#setVisible
   272      * @see Component#setVisible
       
   273      *
   263      * @since 1.4
   274      * @since 1.4
   264      */
   275      */
   265     public void setFullScreenWindow(Window w) {
   276     public void setFullScreenWindow(Window w) {
   266         if (w != null) {
   277         if (w != null) {
   267             //XXX: The actions should be documented in some non-update release.
       
   268             /*
       
   269             if (w.getShape() != null) {
   278             if (w.getShape() != null) {
   270                 w.setShape(w, null);
   279                 w.setShape(null);
   271             }
       
   272             if (!w.isOpaque()) {
       
   273                 w.setOpaque(false);
       
   274             }
   280             }
   275             if (w.getOpacity() < 1.0f) {
   281             if (w.getOpacity() < 1.0f) {
   276                 w.setOpacity(1.0f);
   282                 w.setOpacity(1.0f);
   277             }
   283             }
   278             */
   284             Color bgColor = w.getBackground();
   279         }
   285             if (bgColor.getAlpha() < 255) {
   280 
   286                 bgColor = new Color(bgColor.getRed(), bgColor.getGreen(),
       
   287                                     bgColor.getBlue(), 255);
       
   288                 w.setBackground(bgColor);
       
   289             }
       
   290         }
   281         if (fullScreenWindow != null && windowedModeBounds != null) {
   291         if (fullScreenWindow != null && windowedModeBounds != null) {
   282             // if the window went into fs mode before it was realized it may
   292             // if the window went into fs mode before it was realized it may
   283             // have (0,0) dimensions
   293             // have (0,0) dimensions
   284             if (windowedModeBounds.width  == 0) windowedModeBounds.width  = 1;
   294             if (windowedModeBounds.width  == 0) windowedModeBounds.width  = 1;
   285             if (windowedModeBounds.height == 0) windowedModeBounds.height = 1;
   295             if (windowedModeBounds.height == 0) windowedModeBounds.height = 1;
   467     public int getAvailableAcceleratedMemory() {
   477     public int getAvailableAcceleratedMemory() {
   468         return -1;
   478         return -1;
   469     }
   479     }
   470 
   480 
   471     /**
   481     /**
   472      * Returns whether the given level of translucency is supported
   482      * Returns whether the given level of translucency is supported by
   473      * this graphics device.
   483      * this graphics device.
   474      *
   484      *
   475      * @param translucencyKind a kind of translucency support
   485      * @param translucencyKind a kind of translucency support
   476      * @return whether the given translucency kind is supported
   486      * @return whether the given translucency kind is supported
   477      */
   487      *
   478     /*public */boolean isWindowTranslucencySupported(WindowTranslucency translucencyKind) {
   488      * @since 1.7
       
   489      */
       
   490     public boolean isWindowTranslucencySupported(WindowTranslucency translucencyKind) {
   479         switch (translucencyKind) {
   491         switch (translucencyKind) {
   480             case PERPIXEL_TRANSPARENT:
   492             case PERPIXEL_TRANSPARENT:
   481                 return isWindowShapingSupported();
   493                 return isWindowShapingSupported();
   482             case TRANSLUCENT:
   494             case TRANSLUCENT:
   483                 return isWindowOpacitySupported();
   495                 return isWindowOpacitySupported();