Java Code Examples for sun.awt.SunToolkit#prepareImage()

The following examples show how to use sun.awt.SunToolkit#prepareImage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiResolutionToolkitImageTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
static void testToolkitMultiResolutionImageLoad() throws Exception {
    File imageFile = new File(IMAGE_NAME_1X);
    String fileName = imageFile.getAbsolutePath();
    Image image = Toolkit.getDefaultToolkit().getImage(fileName);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.prepareImage(image, -1, -1, new LoadImageObserver());

    final long time = WAIT_TIME + System.currentTimeMillis();
    while ((!isImageLoaded || !isRVObserverCalled)
            && System.currentTimeMillis() < time) {
        Thread.sleep(50);
    }

    if(!isImageLoaded){
        throw new RuntimeException("Image is not loaded!");
    }

    if(!isRVObserverCalled){
        throw new RuntimeException("Resolution Variant observer is not called!");
    }
}
 
Example 2
Source File: MultiResolutionToolkitImageTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
static void testToolkitMultiResolutionImageLoad() throws Exception {
    File imageFile = new File(IMAGE_NAME_1X);
    String fileName = imageFile.getAbsolutePath();
    Image image = Toolkit.getDefaultToolkit().getImage(fileName);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.prepareImage(image, -1, -1, new LoadImageObserver());

    final long time = WAIT_TIME + System.currentTimeMillis();
    while ((!isImageLoaded || !isRVObserverCalled)
            && System.currentTimeMillis() < time) {
        Thread.sleep(50);
    }

    if(!isImageLoaded){
        throw new RuntimeException("Image is not loaded!");
    }

    if(!isRVObserverCalled){
        throw new RuntimeException("Resolution Variant observer is not called!");
    }
}
 
Example 3
Source File: MultiResolutionToolkitImageTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
static void testToolkitMultiResolutionImageLoad() throws Exception {
    File imageFile = new File(IMAGE_NAME_1X);
    String fileName = imageFile.getAbsolutePath();
    Image image = Toolkit.getDefaultToolkit().getImage(fileName);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.prepareImage(image, -1, -1, new LoadImageObserver());

    final long time = WAIT_TIME + System.currentTimeMillis();
    while ((!isImageLoaded || !isRVObserverCalled)
            && System.currentTimeMillis() < time) {
        Thread.sleep(50);
    }

    if(!isImageLoaded){
        throw new RuntimeException("Image is not loaded!");
    }

    if(!isRVObserverCalled){
        throw new RuntimeException("Resolution Variant observer is not called!");
    }
}
 
Example 4
Source File: MultiResolutionToolkitImageTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
static void testToolkitMultiResolutionImageLoad() throws Exception {
    File imageFile = new File(IMAGE_NAME_1X);
    String fileName = imageFile.getAbsolutePath();
    Image image = Toolkit.getDefaultToolkit().getImage(fileName);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.prepareImage(image, -1, -1, new LoadImageObserver());

    final long time = WAIT_TIME + System.currentTimeMillis();
    while ((!isImageLoaded || !isRVObserverCalled)
            && System.currentTimeMillis() < time) {
        Thread.sleep(50);
    }

    if(!isImageLoaded){
        throw new RuntimeException("Image is not loaded!");
    }

    if(!isRVObserverCalled){
        throw new RuntimeException("Resolution Variant observer is not called!");
    }
}
 
Example 5
Source File: MultiResolutionToolkitImageTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
static void testToolkitMultiResolutionImageLoad() throws Exception {
    File imageFile = new File(IMAGE_NAME_1X);
    String fileName = imageFile.getAbsolutePath();
    Image image = Toolkit.getDefaultToolkit().getImage(fileName);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.prepareImage(image, -1, -1, new LoadImageObserver());

    final long time = WAIT_TIME + System.currentTimeMillis();
    while ((!isImageLoaded || !isRVObserverCalled)
            && System.currentTimeMillis() < time) {
        Thread.sleep(50);
    }

    if(!isImageLoaded){
        throw new RuntimeException("Image is not loaded!");
    }

    if(!isRVObserverCalled){
        throw new RuntimeException("Resolution Variant observer is not called!");
    }
}
 
Example 6
Source File: MultiResolutionToolkitImageTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
static void testToolkitMultiResolutionImageLoad() throws Exception {
    File imageFile = new File(IMAGE_NAME_1X);
    String fileName = imageFile.getAbsolutePath();
    Image image = Toolkit.getDefaultToolkit().getImage(fileName);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.prepareImage(image, -1, -1, new LoadImageObserver());

    final long time = WAIT_TIME + System.currentTimeMillis();
    while ((!isImageLoaded || !isRVObserverCalled)
            && System.currentTimeMillis() < time) {
        Thread.sleep(50);
    }

    if(!isImageLoaded){
        throw new RuntimeException("Image is not loaded!");
    }

    if(!isRVObserverCalled){
        throw new RuntimeException("Resolution Variant observer is not called!");
    }
}
 
Example 7
Source File: MultiResolutionToolkitImageTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
static void testToolkitMultiResolutionImageLoad() throws Exception {
    File imageFile = new File(IMAGE_NAME_1X);
    String fileName = imageFile.getAbsolutePath();
    Image image = Toolkit.getDefaultToolkit().getImage(fileName);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.prepareImage(image, -1, -1, new LoadImageObserver());

    final long time = WAIT_TIME + System.currentTimeMillis();
    while ((!isImageLoaded || !isRVObserverCalled)
            && System.currentTimeMillis() < time) {
        Thread.sleep(50);
    }

    if(!isImageLoaded){
        throw new RuntimeException("Image is not loaded!");
    }

    if(!isRVObserverCalled){
        throw new RuntimeException("Resolution Variant observer is not called!");
    }
}
 
Example 8
Source File: MultiResolutionToolkitImageTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
static void testToolkitMultiResolutionImageLoad() throws Exception {
    File imageFile = new File(IMAGE_NAME_1X);
    String fileName = imageFile.getAbsolutePath();
    Image image = Toolkit.getDefaultToolkit().getImage(fileName);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.prepareImage(image, -1, -1, new LoadImageObserver());

    final long time = WAIT_TIME + System.currentTimeMillis();
    while ((!isImageLoaded || !isRVObserverCalled)
            && System.currentTimeMillis() < time) {
        Thread.sleep(50);
    }

    if(!isImageLoaded){
        throw new RuntimeException("Image is not loaded!");
    }

    if(!isRVObserverCalled){
        throw new RuntimeException("Resolution Variant observer is not called!");
    }
}
 
Example 9
Source File: MultiResolutionToolkitImageTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
static void testToolkitMultiResolutionImageLoad() throws Exception {
    File imageFile = new File(IMAGE_NAME_1X);
    String fileName = imageFile.getAbsolutePath();
    Image image = Toolkit.getDefaultToolkit().getImage(fileName);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.prepareImage(image, -1, -1, new LoadImageObserver());

    final long time = WAIT_TIME + System.currentTimeMillis();
    while ((!isImageLoaded || !isRVObserverCalled)
            && System.currentTimeMillis() < time) {
        Thread.sleep(50);
    }

    if(!isImageLoaded){
        throw new RuntimeException("Image is not loaded!");
    }

    if(!isRVObserverCalled){
        throw new RuntimeException("Resolution Variant observer is not called!");
    }
}
 
Example 10
Source File: MultiResolutionToolkitImageTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static void testToolkitMultiResolutionImageLoad() throws Exception {
    File imageFile = new File(IMAGE_NAME_1X);
    String fileName = imageFile.getAbsolutePath();
    Image image = Toolkit.getDefaultToolkit().getImage(fileName);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.prepareImage(image, -1, -1, new LoadImageObserver());

    final long time = WAIT_TIME + System.currentTimeMillis();
    while ((!isImageLoaded || !isRVObserverCalled)
            && System.currentTimeMillis() < time) {
        Thread.sleep(50);
    }

    if(!isImageLoaded){
        throw new RuntimeException("Image is not loaded!");
    }

    if(!isRVObserverCalled){
        throw new RuntimeException("Resolution Variant observer is not called!");
    }
}
 
Example 11
Source File: MultiResolutionToolkitImageTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
static void testToolkitMultiResolutionImageLoad() throws Exception {
    File imageFile = new File(IMAGE_NAME_1X);
    String fileName = imageFile.getAbsolutePath();
    Image image = Toolkit.getDefaultToolkit().getImage(fileName);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    toolkit.prepareImage(image, -1, -1, new LoadImageObserver());

    final long time = WAIT_TIME + System.currentTimeMillis();
    while ((!isImageLoaded || !isRVObserverCalled)
            && System.currentTimeMillis() < time) {
        Thread.sleep(50);
    }

    if(!isImageLoaded){
        throw new RuntimeException("Image is not loaded!");
    }

    if(!isRVObserverCalled){
        throw new RuntimeException("Resolution Variant observer is not called!");
    }
}
 
Example 12
Source File: MultiResolutionImageTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
static void testToolkitMultiResolutionImagePrepare() throws Exception {

        generateImages();

        File imageFile = new File(IMAGE_NAME_1X);
        String fileName = imageFile.getAbsolutePath();

        Image image = Toolkit.getDefaultToolkit().getImage(fileName);

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT, new LoadImageObserver(image));

        testToolkitMultiResolutionImageLoad(image);
    }
 
Example 13
Source File: MultiResolutionImageTest.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
static void testToolkitMultiResolutionImagePrepare() throws Exception {

        generateImages();

        File imageFile = new File(IMAGE_NAME_1X);
        String fileName = imageFile.getAbsolutePath();

        Image image = Toolkit.getDefaultToolkit().getImage(fileName);

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT, new LoadImageObserver(image));

        testToolkitMultiResolutionImageLoad(image);
    }
 
Example 14
Source File: MultiResolutionImageTest.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
static void testToolkitMultiResolutionImagePrepare() throws Exception {

        generateImages();

        File imageFile = new File(IMAGE_NAME_1X);
        String fileName = imageFile.getAbsolutePath();

        Image image = Toolkit.getDefaultToolkit().getImage(fileName);

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT, new LoadImageObserver(image));

        testToolkitMultiResolutionImageLoad(image);
    }
 
Example 15
Source File: MultiResolutionImageTest.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
static void testToolkitMultiResolutionImagePrepare() throws Exception {

        generateImages();

        File imageFile = new File(IMAGE_NAME_1X);
        String fileName = imageFile.getAbsolutePath();

        Image image = Toolkit.getDefaultToolkit().getImage(fileName);

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT, new LoadImageObserver(image));

        testToolkitMultiResolutionImageLoad(image);
    }
 
Example 16
Source File: MultiResolutionImageTest.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
static void testToolkitMultiResolutionImagePrepare() throws Exception {

        generateImages();

        File imageFile = new File(IMAGE_NAME_1X);
        String fileName = imageFile.getAbsolutePath();

        Image image = Toolkit.getDefaultToolkit().getImage(fileName);

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT, new LoadImageObserver(image));

        testToolkitMultiResolutionImageLoad(image);
    }
 
Example 17
Source File: MultiResolutionImageTest.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
static void testToolkitMultiResolutionImagePrepare() throws Exception {

        generateImages();

        File imageFile = new File(IMAGE_NAME_1X);
        String fileName = imageFile.getAbsolutePath();

        Image image = Toolkit.getDefaultToolkit().getImage(fileName);

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT, new LoadImageObserver(image));

        testToolkitMultiResolutionImageLoad(image);
    }
 
Example 18
Source File: MultiResolutionImageTest.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
static void testToolkitMultiResolutionImagePrepare() throws Exception {

        generateImages();

        File imageFile = new File(IMAGE_NAME_1X);
        String fileName = imageFile.getAbsolutePath();

        Image image = Toolkit.getDefaultToolkit().getImage(fileName);

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT, new LoadImageObserver(image));

        testToolkitMultiResolutionImageLoad(image);
    }
 
Example 19
Source File: MultiResolutionImageTest.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
static void testToolkitMultiResolutionImagePrepare() throws Exception {

        generateImages();

        File imageFile = new File(IMAGE_NAME_1X);
        String fileName = imageFile.getAbsolutePath();

        Image image = Toolkit.getDefaultToolkit().getImage(fileName);

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT, new LoadImageObserver(image));

        testToolkitMultiResolutionImageLoad(image);
    }
 
Example 20
Source File: MultiResolutionImageTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 3 votes vote down vote up
static void testToolkitMultiResolutionImagePrepare() throws Exception {

        generateImages();

        File imageFile = new File(IMAGE_NAME_1X);
        String fileName = imageFile.getAbsolutePath();

        Image image = Toolkit.getDefaultToolkit().getImage(fileName);

        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT, new LoadImageObserver(image));

        testToolkitMultiResolutionImageLoad(image);
    }