|
|
Example of creating the main window with subclass of Frame A simple application using the approach would require 2 source files, MainWindow.java: class MainWindow extends Frame { // MainWindow methods go here public MainWindow() // constructor { super("My programs title"); setSize (300, 300); } } // class
and MyWindowApp.java { public static void main(String args[]) { MainWindow mainWindow = new MainWindow(); mainWindow.setVisible (true); } } // class
This application does not handle window events the window will not close when we try to close the applet or click on top right hand button 'x'. to stop the MyWindowApp from Kawa, you need to select stop run from the Build pull down menu. 
When running this application simple displays an empty Frame window with the title My programs title: 
Back to top 
RITSEC - Global Campus Copyright ?1999 RITSEC- Middlesex University. All rights reserved. webmaster@globalcampus.com.eg |
|