641 * of the following formats: GIF, JPEG or PNG. 642 * The underlying toolkit attempts to resolve multiple requests 643 * with the same URL to the same returned Image. 644 * <p> 645 * Since the mechanism required to facilitate this sharing of 646 * {@code Image} objects may continue to hold onto images 647 * that are no longer in use for an indefinite period of time, 648 * developers are encouraged to implement their own caching of 649 * images by using the {@link #createImage(java.net.URL) createImage} 650 * variant wherever available. 651 * If the image data stored at the specified URL changes, 652 * the {@code Image} object returned from this method may 653 * still contain stale information which was fetched from the 654 * URL after a prior call. 655 * Previously loaded image data can be manually discarded by 656 * calling the {@link Image#flush flush} method on the 657 * returned {@code Image}. 658 * <p> 659 * This method first checks if there is a security manager installed. 660 * If so, the method calls the security manager's 661 * {@code checkPermission} method with the 662 * url.openConnection().getPermission() permission to ensure 663 * that the access to the image is allowed. For compatibility 664 * with pre-1.2 security managers, if the access is denied with 665 * {@code FilePermission} or {@code SocketPermission}, 666 * the method throws the {@code SecurityException} 667 * if the corresponding 1.1-style SecurityManager.checkXXX method 668 * also denies permission. 669 * @param url the URL to use in fetching the pixel data. 670 * @return an image which gets its pixel data from 671 * the specified URL. 672 * @throws SecurityException if a security manager exists and its 673 * checkPermission method doesn't allow 674 * the operation. 675 * @see #createImage(java.net.URL) 676 */ 677 public abstract Image getImage(URL url); 678 679 /** 680 * Returns an image which gets pixel data from the specified file. 681 * The returned Image is a new object which will not be shared 682 * with any other caller of this method or its getImage variant. 683 * <p> 684 * This method first checks if there is a security manager installed. 685 * If so, the method calls the security manager's 686 * {@code checkRead} method with the specified file to ensure 687 * that the image creation is allowed. 688 * @param filename the name of a file containing pixel data 689 * in a recognized file format. 690 * @return an image which gets its pixel data from 691 * the specified file. 692 * @throws SecurityException if a security manager exists and its 693 * checkRead method doesn't allow the operation. 694 * @see #getImage(java.lang.String) 695 */ 696 public abstract Image createImage(String filename); 697 698 /** 699 * Returns an image which gets pixel data from the specified URL. 700 * The returned Image is a new object which will not be shared 701 * with any other caller of this method or its getImage variant. 702 * <p> 703 * This method first checks if there is a security manager installed. 704 * If so, the method calls the security manager's 705 * {@code checkPermission} method with the 706 * url.openConnection().getPermission() permission to ensure 707 * that the image creation is allowed. For compatibility 708 * with pre-1.2 security managers, if the access is denied with 709 * {@code FilePermission} or {@code SocketPermission}, 710 * the method throws {@code SecurityException} 711 * if the corresponding 1.1-style SecurityManager.checkXXX method 712 * also denies permission. 713 * @param url the URL to use in fetching the pixel data. 714 * @return an image which gets its pixel data from 715 * the specified URL. 716 * @throws SecurityException if a security manager exists and its 717 * checkPermission method doesn't allow 718 * the operation. 719 * @see #getImage(java.net.URL) 720 */ 721 public abstract Image createImage(URL url); 722 723 /** 724 * Prepares an image for rendering. 725 * <p> 726 * If the values of the width and height arguments are both 727 * {@code -1}, this method prepares the image for rendering 728 * on the default screen; otherwise, this method prepares an image 729 * for rendering on the default screen at the specified width and height. | 641 * of the following formats: GIF, JPEG or PNG. 642 * The underlying toolkit attempts to resolve multiple requests 643 * with the same URL to the same returned Image. 644 * <p> 645 * Since the mechanism required to facilitate this sharing of 646 * {@code Image} objects may continue to hold onto images 647 * that are no longer in use for an indefinite period of time, 648 * developers are encouraged to implement their own caching of 649 * images by using the {@link #createImage(java.net.URL) createImage} 650 * variant wherever available. 651 * If the image data stored at the specified URL changes, 652 * the {@code Image} object returned from this method may 653 * still contain stale information which was fetched from the 654 * URL after a prior call. 655 * Previously loaded image data can be manually discarded by 656 * calling the {@link Image#flush flush} method on the 657 * returned {@code Image}. 658 * <p> 659 * This method first checks if there is a security manager installed. 660 * If so, the method calls the security manager's 661 * {@code checkPermission} method with the corresponding 662 * permission to ensure that the access to the image is allowed. 663 * If the connection to the specified URL requires 664 * either {@code URLPermission} or {@code SocketPermission}, 665 * then {@code URLPermission} is used for security checks. 666 * For compatibility with pre-1.2 security managers, if the access 667 * is denied with {@code FilePermission} or {@code SocketPermission}, 668 * the method throws the {@code SecurityException} 669 * if the corresponding 1.1-style SecurityManager.checkXXX method 670 * also denies permission. 671 * @param url the URL to use in fetching the pixel data. 672 * @return an image which gets its pixel data from 673 * the specified URL. 674 * @throws SecurityException if a security manager exists and its 675 * checkPermission method doesn't allow 676 * the operation. 677 * @see #createImage(java.net.URL) 678 */ 679 public abstract Image getImage(URL url); 680 681 /** 682 * Returns an image which gets pixel data from the specified file. 683 * The returned Image is a new object which will not be shared 684 * with any other caller of this method or its getImage variant. 685 * <p> 686 * This method first checks if there is a security manager installed. 687 * If so, the method calls the security manager's 688 * {@code checkRead} method with the specified file to ensure 689 * that the image creation is allowed. 690 * @param filename the name of a file containing pixel data 691 * in a recognized file format. 692 * @return an image which gets its pixel data from 693 * the specified file. 694 * @throws SecurityException if a security manager exists and its 695 * checkRead method doesn't allow the operation. 696 * @see #getImage(java.lang.String) 697 */ 698 public abstract Image createImage(String filename); 699 700 /** 701 * Returns an image which gets pixel data from the specified URL. 702 * The returned Image is a new object which will not be shared 703 * with any other caller of this method or its getImage variant. 704 * <p> 705 * This method first checks if there is a security manager installed. 706 * If so, the method calls the security manager's 707 * {@code checkPermission} method with the corresponding 708 * permission to ensure that the image creation is allowed. 709 * If the connection to the specified URL requires 710 * either {@code URLPermission} or {@code SocketPermission}, 711 * then {@code URLPermission} is used for security checks. 712 * For compatibility with pre-1.2 security managers, if the access 713 * is denied with {@code FilePermission} or {@code SocketPermission}, 714 * the method throws {@code SecurityException} 715 * if the corresponding 1.1-style SecurityManager.checkXXX method 716 * also denies permission. 717 * @param url the URL to use in fetching the pixel data. 718 * @return an image which gets its pixel data from 719 * the specified URL. 720 * @throws SecurityException if a security manager exists and its 721 * checkPermission method doesn't allow 722 * the operation. 723 * @see #getImage(java.net.URL) 724 */ 725 public abstract Image createImage(URL url); 726 727 /** 728 * Prepares an image for rendering. 729 * <p> 730 * If the values of the width and height arguments are both 731 * {@code -1}, this method prepares the image for rendering 732 * on the default screen; otherwise, this method prepares an image 733 * for rendering on the default screen at the specified width and height. |