// File: TestAwt14.java (Module 9) // // Author: Rahul Simha // Created: October 13, 1998 // // Images. import java.awt.*; class NewFrame extends Frame { // Constructor. public NewFrame (int width, int height) { // Set the title and other frame parameters. this.setTitle ("Bugs"); this.setResizable (true); this.setBackground (Color.cyan); this.setSize (width, height); // Show the frame. this.setVisible (true); } // Override paint(): public void paint (Graphics g) { // Get a Toolkit instance. Toolkit tk = Toolkit.getDefaultToolkit (); // Provide a filename to the getImage() method. Image img = tk.getImage ("bugs.gif"); // Use the drawImage method. g.drawImage (img, 0, 0, this); // Note: we pass "this" as a parameter. } // "paint" } // End of class "NewFrame" public class TestAwt13 { public static void main (String[] argv) { NewFrame nf = new NewFrame (300, 200); } }