|
|
Converting an applet to an application It is very straightforward to convert an applet to a stand-alone application. Remember that the add() method can add any Java user interface element to a window. An applet is simply an object of Applet class, so we can add() an applet to a Frame very easily. Suppose we have an applet called MyApplet and we wish it to be inside the main window of an application. All that needs to be done is to add the following line to the main windows constructor: add(new MyApplet()); Since we already have a do-nothing application ( DoNothing.java ), we can use this to form the main window for an applet, and therefore convert any applet into an application. Note that it is not necessary to change the applet at all for this to work. Back to top 
RITSEC - Global Campus Copyright ?1999 RITSEC- Middlesex University. All rights reserved. webmaster@globalcampus.com.eg |
|