< prev index next >

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

Print this page




 661      * {@code Image} objects may continue to hold onto images
 662      * that are no longer in use for an indefinite period of time,
 663      * developers are encouraged to implement their own caching of
 664      * images by using the {@link #createImage(java.net.URL) createImage}
 665      * variant wherever available.
 666      * If the image data stored at the specified URL changes,
 667      * the {@code Image} object returned from this method may
 668      * still contain stale information which was fetched from the
 669      * URL after a prior call.
 670      * Previously loaded image data can be manually discarded by
 671      * calling the {@link Image#flush flush} method on the
 672      * returned {@code Image}.
 673      * <p>
 674      * This method first checks if there is a security manager installed.
 675      * If so, the method calls the security manager's
 676      * {@code checkPermission} method with the corresponding
 677      * permission to ensure that the access to the image is allowed.
 678      * If the connection to the specified URL requires
 679      * either {@code URLPermission} or {@code SocketPermission},
 680      * then {@code URLPermission} is used for security checks.
 681      * For compatibility with pre-1.2 security managers, if the access
 682      * is denied with {@code FilePermission} or {@code SocketPermission},
 683      * the method throws the {@code SecurityException}
 684      * if the corresponding 1.1-style SecurityManager.checkXXX method
 685      * also denies permission.
 686      * @param     url   the URL to use in fetching the pixel data.
 687      * @return    an image which gets its pixel data from
 688      *                         the specified URL.
 689      * @throws SecurityException  if a security manager exists and its
 690      *                            checkPermission method doesn't allow
 691      *                            the operation.
 692      * @see #createImage(java.net.URL)
 693      */
 694     public abstract Image getImage(URL url);
 695 
 696     /**
 697      * Returns an image which gets pixel data from the specified file.
 698      * The returned Image is a new object which will not be shared
 699      * with any other caller of this method or its getImage variant.
 700      * <p>
 701      * This method first checks if there is a security manager installed.
 702      * If so, the method calls the security manager's
 703      * {@code checkRead} method with the specified file to ensure
 704      * that the image creation is allowed.
 705      * @param     filename   the name of a file containing pixel data


 707      * @return    an image which gets its pixel data from
 708      *                         the specified file.
 709      * @throws SecurityException  if a security manager exists and its
 710      *                            checkRead method doesn't allow the operation.
 711      * @see #getImage(java.lang.String)
 712      */
 713     public abstract Image createImage(String filename);
 714 
 715     /**
 716      * Returns an image which gets pixel data from the specified URL.
 717      * The returned Image is a new object which will not be shared
 718      * with any other caller of this method or its getImage variant.
 719      * <p>
 720      * This method first checks if there is a security manager installed.
 721      * If so, the method calls the security manager's
 722      * {@code checkPermission} method with the corresponding
 723      * permission to ensure that the image creation is allowed.
 724      * If the connection to the specified URL requires
 725      * either {@code URLPermission} or {@code SocketPermission},
 726      * then {@code URLPermission} is used for security checks.
 727      * For compatibility with pre-1.2 security managers, if the access
 728      * is denied with {@code FilePermission} or {@code SocketPermission},
 729      * the method throws {@code SecurityException}
 730      * if the corresponding 1.1-style SecurityManager.checkXXX method
 731      * also denies permission.
 732      * @param     url   the URL to use in fetching the pixel data.
 733      * @return    an image which gets its pixel data from
 734      *                         the specified URL.
 735      * @throws SecurityException  if a security manager exists and its
 736      *                            checkPermission method doesn't allow
 737      *                            the operation.
 738      * @see #getImage(java.net.URL)
 739      */
 740     public abstract Image createImage(URL url);
 741 
 742     /**
 743      * Prepares an image for rendering.
 744      * <p>
 745      * If the values of the width and height arguments are both
 746      * {@code -1}, this method prepares the image for rendering
 747      * on the default screen; otherwise, this method prepares an image
 748      * for rendering on the default screen at the specified width and height.
 749      * <p>
 750      * The image data is downloaded asynchronously in another thread,
 751      * and an appropriately scaled screen representation of the image is




 661      * {@code Image} objects may continue to hold onto images
 662      * that are no longer in use for an indefinite period of time,
 663      * developers are encouraged to implement their own caching of
 664      * images by using the {@link #createImage(java.net.URL) createImage}
 665      * variant wherever available.
 666      * If the image data stored at the specified URL changes,
 667      * the {@code Image} object returned from this method may
 668      * still contain stale information which was fetched from the
 669      * URL after a prior call.
 670      * Previously loaded image data can be manually discarded by
 671      * calling the {@link Image#flush flush} method on the
 672      * returned {@code Image}.
 673      * <p>
 674      * This method first checks if there is a security manager installed.
 675      * If so, the method calls the security manager's
 676      * {@code checkPermission} method with the corresponding
 677      * permission to ensure that the access to the image is allowed.
 678      * If the connection to the specified URL requires
 679      * either {@code URLPermission} or {@code SocketPermission},
 680      * then {@code URLPermission} is used for security checks.





 681      * @param     url   the URL to use in fetching the pixel data.
 682      * @return    an image which gets its pixel data from
 683      *                         the specified URL.
 684      * @throws SecurityException  if a security manager exists and its
 685      *                            checkPermission method doesn't allow
 686      *                            the operation.
 687      * @see #createImage(java.net.URL)
 688      */
 689     public abstract Image getImage(URL url);
 690 
 691     /**
 692      * Returns an image which gets pixel data from the specified file.
 693      * The returned Image is a new object which will not be shared
 694      * with any other caller of this method or its getImage variant.
 695      * <p>
 696      * This method first checks if there is a security manager installed.
 697      * If so, the method calls the security manager's
 698      * {@code checkRead} method with the specified file to ensure
 699      * that the image creation is allowed.
 700      * @param     filename   the name of a file containing pixel data


 702      * @return    an image which gets its pixel data from
 703      *                         the specified file.
 704      * @throws SecurityException  if a security manager exists and its
 705      *                            checkRead method doesn't allow the operation.
 706      * @see #getImage(java.lang.String)
 707      */
 708     public abstract Image createImage(String filename);
 709 
 710     /**
 711      * Returns an image which gets pixel data from the specified URL.
 712      * The returned Image is a new object which will not be shared
 713      * with any other caller of this method or its getImage variant.
 714      * <p>
 715      * This method first checks if there is a security manager installed.
 716      * If so, the method calls the security manager's
 717      * {@code checkPermission} method with the corresponding
 718      * permission to ensure that the image creation is allowed.
 719      * If the connection to the specified URL requires
 720      * either {@code URLPermission} or {@code SocketPermission},
 721      * then {@code URLPermission} is used for security checks.





 722      * @param     url   the URL to use in fetching the pixel data.
 723      * @return    an image which gets its pixel data from
 724      *                         the specified URL.
 725      * @throws SecurityException  if a security manager exists and its
 726      *                            checkPermission method doesn't allow
 727      *                            the operation.
 728      * @see #getImage(java.net.URL)
 729      */
 730     public abstract Image createImage(URL url);
 731 
 732     /**
 733      * Prepares an image for rendering.
 734      * <p>
 735      * If the values of the width and height arguments are both
 736      * {@code -1}, this method prepares the image for rendering
 737      * on the default screen; otherwise, this method prepares an image
 738      * for rendering on the default screen at the specified width and height.
 739      * <p>
 740      * The image data is downloaded asynchronously in another thread,
 741      * and an appropriately scaled screen representation of the image is


< prev index next >