Package java.awt

Examples of java.awt.MediaTracker


  private BufferedImage convertToBufferedImage(Image image) throws IOException {
        if (image instanceof BufferedImage) {
            return (BufferedImage)image;

        } else {
            @SuppressWarnings("serial")
      MediaTracker tracker = new MediaTracker(new Component(){}); // not sure if this is the right thing to do.
            tracker.addImage(image, 0);
            try {
                tracker.waitForAll();
            } catch (InterruptedException e) {
                throw new IOException(e.getMessage());
            }
            BufferedImage bufImage = new BufferedImage(
                    image.getWidth(null),
View Full Code Here


  }   // end class AlertListUpdater definition
 
  public void init()
  {
    String backgroundImage = this.getParameter("background-image");
    mt = new MediaTracker(this);
    theBackGround = this.getImage(this.getCodeBase(), backgroundImage);
    String alertIcon = this.getParameter("alert-icon");
    theAlertIcon = this.getImage(this.getCodeBase(), alertIcon);
    mt.addImage(theBackGround, 0);
    mt.addImage(theAlertIcon, 0);
View Full Code Here

  public static void waitForImageData(Image image, Component comp) {
    if (comp == null) {
      comp = HELPER_LABEL;
    }
   
    MediaTracker tracker = new MediaTracker(comp);
    tracker.addImage(image, 0);
    try {
      tracker.waitForID(0);
    }
    catch (Exception ex) {
    }
  } // waitForImageData (Image, Component)
View Full Code Here

  public Image getImage(URL url) {
    try {
      Image image = super.getImage(url);

      // wait for image to load
      MediaTracker tracker = new MediaTracker(this);
          tracker.addImage(image, 0);
          tracker.waitForAll();

          // if no errors return image
          if (!tracker.isErrorAny()) {
            return image;
          }
    } catch (Exception e) {
      /* */
    }
 
View Full Code Here

  private synchronized void waitForImage(final java.awt.Image image)
  {
    if (mediaTracker == null)
    {
      mediaTracker = new MediaTracker(new FakeComponent());
    }
    mediaTracker.addImage(image, 0);
    try
    {
      mediaTracker.waitForID(0);
View Full Code Here

   */
  private void drawSampleImage(Graphics g, Dimension d) {
    try {
      Toolkit toolkit = Toolkit.getDefaultToolkit();
      Image img = toolkit.createImage(sampleImageFile);
      MediaTracker tracker = new MediaTracker(drawingArea);
      tracker.addImage(img, 0);
      try {
        tracker.waitForID(0);
      }
      catch (Exception e) {
        e.printStackTrace();
      }
      /* bazsoft
View Full Code Here

        super(owner);
        URL imageURL = SplashScreen.class.getResource("/images/splash.png");
        splashImage = Toolkit.getDefaultToolkit().createImage(imageURL);

        // Load the image
        MediaTracker mt = new MediaTracker(this);
        mt.addImage(splashImage,0);
        try {
            mt.waitForID(0);
        } catch(InterruptedException ie) {}

                                                                               
        // Center the window on the screen.
        int imgWidth = splashImage.getWidth(this);
View Full Code Here

        awtFrame = new Frame();
      } catch (Exception e) { throw new InstantiationException("Cannot instantiate java.awt.Frame " + (e.getMessage()!=null ? e.getMessage() : "")); }

      if (DebugFile.trace) DebugFile.writeln("new MediaTracker([Frame])");

      mediaTracker = new MediaTracker(awtFrame);
    } // fi (mediaTracker)

    mediaTracker.addImage(oImg, 0);
    mediaTracker.waitForID(0);
View Full Code Here

          awtFrame = new Frame();
        } catch (Exception e) { throw new InstantiationException("Cannot instantiate java.awt.Frame " + (e.getMessage()!=null ? e.getMessage() : "")); }

        if (DebugFile.trace) DebugFile.writeln("new MediaTracker([Frame])");

        mediaTracker = new MediaTracker(awtFrame);
      } // fi (mediaTracker)

      mediaTracker.addImage(oImg, 0);
      mediaTracker.waitForID(0);
View Full Code Here

   
    private void createGUI() {
        setLayout(null);
        addMouseListener(this);
        addMouseMotionListener(this);
  MediaTracker mt = new MediaTracker(this);
  image = loadImage("/jamp.jpg", this, true);
  mt.addImage(image, 1);
  try {
      mt.waitForID(1);
  } catch (InterruptedException ie) {
  }
    }
View Full Code Here

TOP

Related Classes of java.awt.MediaTracker

Copyright © 2018 www.massapicom. 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.