FileDocCategorySizeDatePackage
Crop.javaAPI DocExample1268Mon Mar 24 01:58:52 GMT 1997None

Crop

public class Crop extends Applet

Fields Summary
Image
i
Image
j
Constructors Summary
Methods Summary
public voidinit()

        MediaTracker mt = new MediaTracker (this);
        i = getImage (getDocumentBase(), "rosey.jpg");
        mt.addImage (i, 0);
        try {
            mt.waitForAll();
            int width        = i.getWidth(this);
            int height       = i. getHeight(this);
            j = createImage (new FilteredImageSource (i.getSource(),
                                new CropImageFilter (width/3, height/3,
                                                     width/3, height/3)));
        } catch (InterruptedException e) {
            e.printStackTrace();           
        }
    
public voidpaint(java.awt.Graphics g)

        g.drawImage (i, 10, 10, this);                  // regular
        if (j != null) {
            g.drawImage (j, 10, 90, this);             // cropped
        }