You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
767 B
Java

Placing an icon to a frame
package com.ack.gui.awt.simple;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.*;
public class PlacingAnIconToAFrame {
private Frame frame;
public static void main( String[] args ) {
PlacingAnIconToAFrame myExample = new PlacingAnIconToAFrame();
myExample.go();
}
public void go() {
frame = new Frame( "First Gui Example" );
ImageIcon icon = new ImageIcon( "1.gif" );
frame.setIconImage( icon.getImage() );
frame.addWindowListener( new WindowAdapter() {
public void windowClosing( WindowEvent we ) {
System.exit( 0 );
}
} );
frame.pack();
frame.setVisible( true );
}
}