Package java.awt

Examples of java.awt.MediaTracker.waitForID()


            case INPUT_ARRAY:
                do {
                    try {
                        Image img = tk.createImage((byte[])input);
                        mt.addImage(img, 0);
                        mt.waitForID(0, 0);
                        mt.removeImage(img, 0);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } while (--numReps >= 0);
View Full Code Here


            _image = Toolkit.getDefaultToolkit().createImage(url);
            // Load the image
            final MediaTracker mt = new MediaTracker(this);
            mt.addImage(_image, 0);
            try {
                mt.waitForID(0);
            } catch (final InterruptedException ie) {
            }

            // Center the window on the screen.
            final int width = _image.getWidth(this);
View Full Code Here

/*     */   private static final ImageLayout layoutHelper(ImageLayout layout, Image image)
/*     */   {
/*  84 */     MediaTracker tracker = new MediaTracker(new Canvas());
/*  85 */     tracker.addImage(image, 0);
/*     */     try {
/*  87 */       tracker.waitForID(0);
/*     */     } catch (InterruptedException e) {
/*  89 */       e.printStackTrace();
/*  90 */       throw new RuntimeException(JaiI18N.getString("AWTImageOpImage0"));
/*     */     }
/*  92 */     if (tracker.isErrorID(0)) {
View Full Code Here

      byte[] imageBytes = bos.toByteArray();

      Image image = Toolkit.getDefaultToolkit().createImage( imageBytes );
      MediaTracker mediaTracker = new MediaTracker( new Container() );
      mediaTracker.addImage( image, 0 );
      mediaTracker.waitForID( 0 );
      // determine thumbnail size from WIDTH and HEIGHT
      int thumbWidth = 300;
      int thumbHeight = 200;
      double thumbRatio = (double) thumbWidth / (double) thumbHeight;
      int imageWidth = image.getWidth( null );
View Full Code Here

      byte[] imageBytes = bos.toByteArray();

      Image image = Toolkit.getDefaultToolkit().createImage( imageBytes );
      MediaTracker mediaTracker = new MediaTracker( new Container() );
      mediaTracker.addImage( image, 0 );
      mediaTracker.waitForID( 0 );
      // determine thumbnail size from WIDTH and HEIGHT
      int thumbWidth = 300;
      int thumbHeight = 200;
      double thumbRatio = (double) thumbWidth / (double) thumbHeight;
      int imageWidth = image.getWidth( null );
View Full Code Here

        URL url = this.getClass().getResource("/img/" + imgName);
        Image image = tk.getImage(url);
        MediaTracker tracker = new MediaTracker(new Frame());
        try {
            tracker.addImage(image, 0);
            tracker.waitForID(0);
        } catch (InterruptedException ie) {
        }
        return image;
    }
}
View Full Code Here

    try
    {
      image = getSplashImage();
      MediaTracker mt = new MediaTracker(this);
      mt.addImage(image, 0);
      mt.waitForID(0);

      int width = image.getWidth(this);
      int height = image.getHeight(this);
      setPreferredSize(new Dimension(width, height));
      setSize(width, height);
View Full Code Here

                //Comprobamos si se ha leido correctamente la imagen
                if (imagenLeida != null) {
                    try {
                        MediaTracker tracker = new MediaTracker(this);
                        tracker.addImage(imagenLeida, 0);
                        tracker.waitForID(0);
                    } catch (Exception e) {
                        System.out.println(e.getMessage());
                        error = true;
                    }
View Full Code Here

                if (w != width && h != height) {
                    // compute scaled image
                    final Image scaled = image.getScaledInstance(width, height, Image.SCALE_AREA_AVERAGING);
                    final MediaTracker mediaTracker = new MediaTracker(new Container());
                    mediaTracker.addImage(scaled, 0);
                    try {mediaTracker.waitForID(0);} catch (final InterruptedException e) {}

                    // make a BufferedImage out of that
                    final BufferedImage i = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
                    try {
                        i.createGraphics().drawImage(scaled, 0, 0, width, height, null);
View Full Code Here

        // NOTE that this support JPEG, PNG or GIF only.
        Image image = Toolkit.getDefaultToolkit().createImage(data);
        MediaTracker mediaTracker = new MediaTracker(new Frame());
        int trackID = 0;
        mediaTracker.addImage(image, trackID);
        mediaTracker.waitForID(trackID);
        if (image.getWidth(null) <= thumbWidth
                && image.getHeight(null) <= thumbHeight)
            out.write(data);
        else
            createThumb(image, thumbWidth, thumbHeight, out);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.