more examples en
    
 

EXTENDING java.awt.Frame

API

java.awt.Frame
java.awt.event.WindowAdapter
java.awt.event.WindowEvent
java.lang.System

 




When the program is run, a GUI window opens. A click on the rightmost button in the title bar will close the window and shut down the program.

 

 1 package at.krux.gui;

 2 import java.awt.Frame;
 3 import java.awt.event.WindowAdapter;
 4 import java.awt.event.WindowEvent;

 5 public class FrameExtend extends Frame {
	
 6   public FrameExtend() {
 7     this.setSize(300, 400);
 8     this.setLayout(null);

 9     this.addWindowListener(new WindowAdapter() {
10       public void windowClosing(WindowEvent e) {
11         System.exit(0);
12       }
13     });

14     this.setVisible(true);
15   }

16   public static void main(String[] args) {
		
17     new FrameExtend();
18   }
19 }