当前位置: 首页>>代码示例>>Java>>正文


Java MediaTracker.COMPLETE属性代码示例

本文整理汇总了Java中java.awt.MediaTracker.COMPLETE属性的典型用法代码示例。如果您正苦于以下问题:Java MediaTracker.COMPLETE属性的具体用法?Java MediaTracker.COMPLETE怎么用?Java MediaTracker.COMPLETE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.awt.MediaTracker的用法示例。


在下文中一共展示了MediaTracker.COMPLETE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DuplicateAudioDevice

DuplicateAudioDevice() {
	super("");
	
	putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttDuplicateAudioDevice"));
	
	try {
		URL url = ClassLoader.getSystemClassLoader().getResource (
			"org/jsampler/view/classic/res/icons/Copy16.gif"
		);
		
		ImageIcon icon = new ImageIcon(url);
		if(icon.getImageLoadStatus() == MediaTracker.COMPLETE)
			putValue(Action.SMALL_ICON, icon);
	} catch(Exception x) {
		CC.getLogger().log(Level.INFO, HF.getErrorMessage(x), x);
	}
	
	setEnabled(false);
}
 
开发者ID:lxlxlo,项目名称:LS-jsampler,代码行数:19,代码来源:AudioDevicesPage.java

示例2: RemoveAudioDevice

RemoveAudioDevice() {
	super("");
	
	putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttRemoveAudioDevice"));
	
	try {
		URL url = ClassLoader.getSystemClassLoader().getResource (
			"org/jsampler/view/classic/res/icons/Delete16.gif"
		);
		
		ImageIcon icon = new ImageIcon(url);
		if(icon.getImageLoadStatus() == MediaTracker.COMPLETE)
			putValue(Action.SMALL_ICON, icon);
	} catch(Exception x) {
		CC.getLogger().log(Level.INFO, HF.getErrorMessage(x), x);
	}
	
	setEnabled(false);
}
 
开发者ID:lxlxlo,项目名称:LS-jsampler,代码行数:19,代码来源:AudioDevicesPage.java

示例3: AudioDeviceProps

AudioDeviceProps() {
	super("");
	
	putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("ttAudioDeviceProps"));
	
	try {
		URL url = ClassLoader.getSystemClassLoader().getResource (
			"org/jsampler/view/classic/res/icons/Properties16.gif"
		);
		
		ImageIcon icon = new ImageIcon(url);
		if(icon.getImageLoadStatus() == MediaTracker.COMPLETE)
			putValue(Action.SMALL_ICON, icon);
	} catch(Exception x) {
		CC.getLogger().log(Level.INFO, HF.getErrorMessage(x), x);
	}
	
	setEnabled(false);
}
 
开发者ID:lxlxlo,项目名称:LS-jsampler,代码行数:19,代码来源:AudioDevicesPage.java

示例4: setScaledImage

private void setScaledImage(final int largeur, final int hauteur, final Scalr.Mode mode) {
        if(largeur<=0 || hauteur<=0) return;
        if(this.getImageLoadStatus()==MediaTracker.COMPLETE) {
            if(largeurInitiale<=0) {largeurInitiale=this.getIconWidth();}
            if(hauteurInitiale<=0) {hauteurInitiale=this.getIconHeight();}
            this.setImage(ImageTools.getScaledInstance(ImageTools.imageToBufferedImage(this.getImage()), largeur, hauteur, ImageTools.Quality.OPTIMAL, mode));
        }
        getImage().getWidth(new ImageObserver() {
            @Override
            public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
                if((infoflags & ALLBITS)!=0) {
                    if(Icone.this.largeurInitiale<=0) {Icone.this.largeurInitiale=Icone.this.getIconWidth();}
                    if(Icone.this.hauteurInitiale<=0) {Icone.this.hauteurInitiale=Icone.this.getIconHeight();}
                    Icone.this.setImage(ImageTools.getScaledInstance(ImageTools.imageToBufferedImage(Icone.this.getImage()), largeur, hauteur, ImageTools.Quality.OPTIMAL, mode));
                    return false;
                }
                return true;
            }
        });
//        this.setImage(this.getImage().getScaledInstance(largeur, hauteur, Image.SCALE_SMOOTH));
    }
 
开发者ID:Sharcoux,项目名称:MathEOS,代码行数:21,代码来源:Icone.java

示例5: getIcon

private ImageIcon getIcon(String url) {
    if (url == null || url.isEmpty()) {
        return null;
    }
    try {
        ImageIcon icon = new ImageIcon(new URL(url));
        if (icon.getImageLoadStatus() == MediaTracker.COMPLETE) {
            return icon;
        } else {
            LOGGER.warning("Could not load icon: "+url);
        }
    } catch (MalformedURLException ex) {
        LOGGER.warning("Invalid icon url: "+url);
    }
    return null;
}
 
开发者ID:pokemane,项目名称:TwitchChatClient,代码行数:16,代码来源:ChatIcons.java

示例6: preload

/**
 * Preload the image.
 */
public void preload() {
    synchronized (loadingLock) {
        if (image == null) {
            MediaTracker mt = new MediaTracker(_c);
            Image im;
            try {
                // Explicitly check that the URI is valid before
                // letting createImage go off and look for it, as the
                // error it throws is cryptic.
                URL url = getResourceLocator().toURL();
                InputStream is = url.openStream();
                is.close();
                im = Toolkit.getDefaultToolkit().createImage(url);
                mt.addImage(im, 0);
                mt.waitForID(0);
                if (mt.statusID(0, false) == MediaTracker.COMPLETE) {
                    image = im;
                }
            } catch (Exception e) {
                logger.log(Level.WARNING, "Failed to load image from: "
                    + getResourceLocator(), e);
            }
        }
    }
}
 
开发者ID:vishal-mittal,项目名称:SOEN6471-FreeCol,代码行数:28,代码来源:ImageResource.java

示例7: loadImage

public static Image loadImage(String filename, Component watcher, URL url) {
    Image image = null;

    if (url == null) {
        System.err.println("loadImage() could not find \"" + filename + "\"");
    } else {
        image = watcher.getToolkit().getImage(url);
        if (image == null) {
            System.err.println("loadImage() getImage() failed for \"" + filename + "\"");
        } else {
            MediaTracker tracker = new MediaTracker(watcher);

            try {
                tracker.addImage(image, 0);
                tracker.waitForID(0);
            } catch (InterruptedException e) {
                System.err.println("loadImage(): " + e);
            } finally {
                boolean isError = tracker.isErrorAny();
                if (isError) {
                    System.err.println("loadImage() failed to load \"" + filename + "\"");
                    int flags = tracker.statusAll(true);

                    boolean loading = 0 != (flags & MediaTracker.LOADING);
                    boolean aborted = 0 != (flags & MediaTracker.ABORTED);
                    boolean errored = 0 != (flags & MediaTracker.ERRORED);
                    boolean complete = 0 != (flags & MediaTracker.COMPLETE);
                    System.err.println("loading: " + loading);
                    System.err.println("aborted: " + aborted);
                    System.err.println("errored: " + errored);
                    System.err.println("complete: " + complete);
                }
            }
        }
    }

    return image;
}
 
开发者ID:addertheblack,项目名称:myster,代码行数:38,代码来源:Util.java

示例8: BasemapLayer

public BasemapLayer(Layer layer, String thumbnailFilename) {
    this.layer = layer;
    if (null == thumbnailFilename) {
        thumbnail = null;
    } else {
        ImageIcon imageIcon = new ImageIcon(thumbnailFilename);
        thumbnail = MediaTracker.COMPLETE == imageIcon.getImageLoadStatus() ? imageIcon : null;
    }
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:9,代码来源:BasemapLayer.java

示例9: getLoadedImage

/**
 * Ensures the image is loaded enough (loading is fine).
 * 
 * @param newImage to check
 * @return image or null if not loaded enough.
 */
private Image getLoadedImage(final Image newImage) {
    final ImageIcon imageLoader = new ImageIcon(newImage);
    switch (imageLoader.getImageLoadStatus()) {
        case MediaTracker.LOADING:
        case MediaTracker.COMPLETE:
            return imageLoader.getImage();
        default:
            return null;
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:PImage.java

示例10: getImage

/**
 * Loads a cached image from a class offset from the ImageManager
 * waiting for it to be completely loading using a MediaTracker
 * @param imageName the name of the image to load
 * @return the cached image
 */
public ImageIcon getImage(String imageName) {
	ImageIcon image = null;

	if (images.containsKey(imageName)) {
		image = (ImageIcon) images.get(imageName);
	} else {
		URL url = getClass().getResource(imageName);

		if (url == null) {
			//System.out.println("ImageManager.getImage() could not find image: " + imageName);
		} else {
			image = new ImageIcon(getClass().getResource(imageName));

			while (image.getImageLoadStatus() == MediaTracker.LOADING) {
				try {
					Thread.currentThread().wait(100);
				} catch (InterruptedException e) {
				}
			}

			if (image != null && image.getImageLoadStatus() == MediaTracker.COMPLETE) {
				images.put(imageName, image);
			} else {
				//System.out.println("ImageManager.getImage() failed to load image: " + imageName);
			}
		}
	}

	return image;
}
 
开发者ID:mongkoy,项目名称:c-logger,代码行数:36,代码来源:ImageManager.java

示例11: getImage

/**
 * Loads a cached image from a class offset from the ImageManager waiting for it to be completely loading using a
 * MediaTracker
 * @param imageName the name of the image to load
 * @return the cached image
 */
public ImageIcon getImage(String imageName)
{
    ImageIcon image = null;

    if (images.containsKey(imageName))
    {
        image = (ImageIcon) images.get(imageName);
    }
    else
    {
        URL url = getClass().getResource(imageName);

        if (url != null)
        {
            image = new ImageIcon(getClass().getResource(imageName));

            while (image.getImageLoadStatus() == MediaTracker.LOADING)
            {
                try
                {
                    Thread.currentThread().wait(100);
                }
                catch (InterruptedException e)
                {

                }
            }

            if (image != null && image.getImageLoadStatus() == MediaTracker.COMPLETE)
            {
                images.put(imageName, image);
            }
        }
    }

    return image;
}
 
开发者ID:joshpassenger,项目名称:jfreestock,代码行数:43,代码来源:ImageManager.java

示例12: loadImage

/** Ensures the given AWT image is fully loaded. */
public static boolean loadImage(final Image image) {
	if (image instanceof BufferedImage) return true;
	final MediaTracker tracker = new MediaTracker(OBS);
	tracker.addImage(image, 0);
	try {
		tracker.waitForID(0);
	}
	catch (final InterruptedException exc) {
		return false;
	}
	if (MediaTracker.COMPLETE != tracker.statusID(0, false)) return false;
	return true;
}
 
开发者ID:scifio,项目名称:scifio,代码行数:14,代码来源:AWTImageTools.java

示例13: paintComponent

public void paintComponent(Graphics g) {
 super.paintComponent(g);
   System.out.println("paintComponent");
   	    JOptionPane.showMessageDialog(null, "paintComponent");
  if (images[currentImage].getImageLoadStatus() == MediaTracker.COMPLETE) {
    images[currentImage].paintIcon(this, g, 0, 0);
    currentImage = (currentImage + 1) % totalImages;
  }
}
 
开发者ID:col726,项目名称:game-engine-CMZ,代码行数:9,代码来源:AnotherMain.java

示例14: getImage

/**
 * Gets the image using the specified dimension.
 * 
 * @param d The <code>Dimension</code> of the requested
 *      image.  Rescaling will be performed if necessary.
 * @return The <code>Image</code> with the required dimension.
 */
public Image getImage(Dimension d) {
    final Image im = getImage();
    if (im == null
        || (im.getWidth(null) == d.width
            && im.getHeight(null) == d.height)) return im;

    synchronized (loadingLock) {
        final Image cached = scaledImages.get(d);
        if (cached != null) return cached;

        MediaTracker mt = new MediaTracker(_c);
        try {
            // Use SCALE_REPLICATE instead of SCALE_SMOOTH to avoid
            // ClassCastException.
            // TODO (perhaps): find a better solution.
            Image scaled = im.getScaledInstance(d.width, d.height,
                                                Image.SCALE_REPLICATE);
            mt.addImage(scaled, 0, d.width, d.height);
            mt.waitForID(0);
            int result = mt.statusID(0, false);
            if (result == MediaTracker.COMPLETE) {
                scaledImages.put(d, scaled);
            } else {
                logger.warning("Scaling image: " + getResourceLocator()
                    + " => " + result);
            }
            return scaled;
        } catch (Exception e) {
            logger.warning("Failed to scale image: " + getResourceLocator()
                           + "\r\nProblem: " + e );
        }
    }
    return null;
}
 
开发者ID:vishal-mittal,项目名称:SOEN6471-FreeCol,代码行数:41,代码来源:ImageResource.java

示例15: getImageLoadStatus

public int getImageLoadStatus() {
	return MediaTracker.COMPLETE;
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:3,代码来源:ImageIcon.java


注:本文中的java.awt.MediaTracker.COMPLETE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。