Package: java.awt.* |
Product: JDK |
Release: 1.1.x |
Related Links: |
Color
Cursor
FileDialog
Font
FontMetrics
Frame
general
Image
LayoutManager
Menu
ScrollPane
|
Comment: |
An icon is a graphics. This graphics can we connect to a Frame and will be visible at the top-left of the frame. We will use two objects for this; 1) MediaTracker to view the loading of the icon image, 2) Toolkit to load the iconimage We have to following example in which all the icon image stuff is residing in the importer() method: // PacManApp.java // import java.awt.*; public class PacManApp { Image icon; MediaTracker tracker; GUI gui; PlayField playfield; /** default constructor */ public PacManApp( ) { playfield = new PlayField( this, 30, 30); // make a new GUI enclosed in the PacManApp gui = this. new GUI(); gui.setTitle( "Pac-Man" ); // title of frame gui.setSize( 500, 550); // make importer load all images in the PacManApp importer(); gui.setVisible( true ); } |