The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.awt  [78 examples] > Images  [4 examples]

e595. Drawing an Image

See also e575 The Quintessential Drawing Program and e594 Reading an Image or Icon from a File.
    public void paint(Graphics g) {
        // Draw an Image object
        int x = 0;
        int y = 0;
        g.drawImage(image, x, y, this);
    
        // Draw an Icon object
        x = 0;
        y = 100;
        icon.paintIcon(this, g, x, y);
    }

 Related Examples
e594. Reading an Image or Icon from a File
e596. Scaling, Shearing, Translating, and Rotating a Drawn Image
e597. Creating a Gray Version of an Icon

See also: Colors    Components    Containers    Cursors    Drawing    Events    Focus    Frames    GridBagLayout    Shapes    Simulating Events    Text    The Screen   


© 2002 Addison-Wesley.