< prev index next >

src/java.desktop/share/classes/java/awt/Component.java

Print this page




3611             repaint(rate, 0, 0, width, height);
3612         }
3613         return (infoflags & (ALLBITS|ABORT)) == 0;
3614     }
3615 
3616     /**
3617      * Creates an image from the specified image producer.
3618      * @param     producer  the image producer
3619      * @return    the image produced
3620      * @since     1.0
3621      */
3622     public Image createImage(ImageProducer producer) {
3623         ComponentPeer peer = this.peer;
3624         if ((peer != null) && ! (peer instanceof LightweightPeer)) {
3625             return peer.createImage(producer);
3626         }
3627         return getToolkit().createImage(producer);
3628     }
3629 
3630     /**
3631      * Creates an off-screen drawable image
3632      *     to be used for double buffering.
3633      * @param     width the specified width
3634      * @param     height the specified height
3635      * @return    an off-screen drawable image, which can be used for double
3636      *    buffering.  The return value may be <code>null</code> if the
3637      *    component is not displayable.  This will always happen if
3638      *    <code>GraphicsEnvironment.isHeadless()</code> returns
3639      *    <code>true</code>.
3640      * @see #isDisplayable
3641      * @see GraphicsEnvironment#isHeadless
3642      * @since     1.0
3643      */
3644     public Image createImage(int width, int height) {
3645         ComponentPeer peer = this.peer;
3646         if (peer instanceof LightweightPeer) {
3647             if (parent != null) { return parent.createImage(width, height); }
3648             else { return null;}
3649         } else {
3650             return (peer != null) ? peer.createImage(width, height) : null;
3651         }
3652     }
3653 
3654     /**
3655      * Creates a volatile off-screen drawable image
3656      *     to be used for double buffering.
3657      * @param     width the specified width.
3658      * @param     height the specified height.

3659      * @return    an off-screen drawable image, which can be used for double
3660      *    buffering.  The return value may be <code>null</code> if the
3661      *    component is not displayable.  This will always happen if
3662      *    <code>GraphicsEnvironment.isHeadless()</code> returns
3663      *    <code>true</code>.
3664      * @see java.awt.image.VolatileImage
3665      * @see #isDisplayable
3666      * @see GraphicsEnvironment#isHeadless
3667      * @since     1.4
3668      */
3669     public VolatileImage createVolatileImage(int width, int height) {
3670         ComponentPeer peer = this.peer;
3671         if (peer instanceof LightweightPeer) {
3672             if (parent != null) {
3673                 return parent.createVolatileImage(width, height);
3674             }
3675             else { return null;}
3676         } else {
3677             return (peer != null) ?
3678                 peer.createVolatileImage(width, height) : null;
3679         }
3680     }
3681 
3682     /**
3683      * Creates a volatile off-screen drawable image, with the given capabilities.
3684      * The contents of this image may be lost at any time due
3685      * to operating system issues, so the image must be managed
3686      * via the <code>VolatileImage</code> interface.
3687      * @param width the specified width.
3688      * @param height the specified height.

3689      * @param caps the image capabilities
3690      * @exception AWTException if an image with the specified capabilities cannot




3691      * be created
3692      * @return a VolatileImage object, which can be used
3693      * to manage surface contents loss and capabilities.
3694      * @see java.awt.image.VolatileImage
3695      * @since 1.4
3696      */
3697     public VolatileImage createVolatileImage(int width, int height,
3698                                              ImageCapabilities caps) throws AWTException {

3699         // REMIND : check caps
3700         return createVolatileImage(width, height);
3701     }
3702 
3703     /**
3704      * Prepares an image for rendering on this component.  The image
3705      * data is downloaded asynchronously in another thread and the
3706      * appropriate screen representation of the image is generated.
3707      * @param     image   the <code>Image</code> for which to
3708      *                    prepare a screen representation
3709      * @param     observer   the <code>ImageObserver</code> object
3710      *                       to be notified as the image is being prepared
3711      * @return    <code>true</code> if the image has already been fully
3712      *           prepared; <code>false</code> otherwise
3713      * @since     1.0
3714      */
3715     public boolean prepareImage(Image image, ImageObserver observer) {
3716         return prepareImage(image, -1, -1, observer);
3717     }
3718 




3611             repaint(rate, 0, 0, width, height);
3612         }
3613         return (infoflags & (ALLBITS|ABORT)) == 0;
3614     }
3615 
3616     /**
3617      * Creates an image from the specified image producer.
3618      * @param     producer  the image producer
3619      * @return    the image produced
3620      * @since     1.0
3621      */
3622     public Image createImage(ImageProducer producer) {
3623         ComponentPeer peer = this.peer;
3624         if ((peer != null) && ! (peer instanceof LightweightPeer)) {
3625             return peer.createImage(producer);
3626         }
3627         return getToolkit().createImage(producer);
3628     }
3629 
3630     /**
3631      * Creates an off-screen drawable image to be used for double buffering.
3632      *
3633      * @param  width the specified width
3634      * @param  height the specified height
3635      * @return an off-screen drawable image, which can be used for double
3636      *         buffering. The {@code null} value if the component is not
3637      *         displayable or {@code GraphicsEnvironment.isHeadless()} returns
3638      *         {@code true}.

3639      * @see #isDisplayable
3640      * @see GraphicsEnvironment#isHeadless
3641      * @since 1.0
3642      */
3643     public Image createImage(int width, int height) {
3644         ComponentPeer peer = this.peer;
3645         if (peer instanceof LightweightPeer) {
3646             if (parent != null) { return parent.createImage(width, height); }
3647             else { return null;}
3648         } else {
3649             return (peer != null) ? peer.createImage(width, height) : null;
3650         }
3651     }
3652 
3653     /**
3654      * Creates a volatile off-screen drawable image to be used for double
3655      * buffering.
3656      *
3657      * @param  width the specified width
3658      * @param  height the specified height
3659      * @return an off-screen drawable image, which can be used for double
3660      *         buffering. The {@code null} value if the component is not
3661      *         displayable or {@code GraphicsEnvironment.isHeadless()} returns
3662      *         {@code true}.

3663      * @see java.awt.image.VolatileImage
3664      * @see #isDisplayable
3665      * @see GraphicsEnvironment#isHeadless
3666      * @since 1.4
3667      */
3668     public VolatileImage createVolatileImage(int width, int height) {
3669         ComponentPeer peer = this.peer;
3670         if (peer instanceof LightweightPeer) {
3671             if (parent != null) {
3672                 return parent.createVolatileImage(width, height);
3673             }
3674             else { return null;}
3675         } else {
3676             return (peer != null) ?
3677                 peer.createVolatileImage(width, height) : null;
3678         }
3679     }
3680 
3681     /**
3682      * Creates a volatile off-screen drawable image, with the given
3683      * capabilities. The contents of this image may be lost at any time due to
3684      * operating system issues, so the image must be managed via the
3685      * {@code VolatileImage} interface.
3686      *
3687      * @param  width the specified width
3688      * @param  height the specified height
3689      * @param  caps the image capabilities
3690      * @return a VolatileImage object, which can be used to manage surface
3691      *         contents loss and capabilities. The {@code null} value if the
3692      *         component is not displayable or
3693      *         {@code GraphicsEnvironment.isHeadless()} returns {@code true}.
3694      * @throws AWTException if an image with the specified capabilities cannot
3695      *         be created


3696      * @see java.awt.image.VolatileImage
3697      * @since 1.4
3698      */
3699     public VolatileImage createVolatileImage(int width, int height,
3700                                              ImageCapabilities caps)
3701             throws AWTException {
3702         // REMIND : check caps
3703         return createVolatileImage(width, height);
3704     }
3705 
3706     /**
3707      * Prepares an image for rendering on this component.  The image
3708      * data is downloaded asynchronously in another thread and the
3709      * appropriate screen representation of the image is generated.
3710      * @param     image   the <code>Image</code> for which to
3711      *                    prepare a screen representation
3712      * @param     observer   the <code>ImageObserver</code> object
3713      *                       to be notified as the image is being prepared
3714      * @return    <code>true</code> if the image has already been fully
3715      *           prepared; <code>false</code> otherwise
3716      * @since     1.0
3717      */
3718     public boolean prepareImage(Image image, ImageObserver observer) {
3719         return prepareImage(image, -1, -1, observer);
3720     }
3721 


< prev index next >