|
|
||
| You are here: | ||
|
The AddSub Applet as a console application using the IBIO methods.
data members
All applications start with a public static void main(String[] args) method.
It is possible to do all the work of an application in the constructor .
This application follows the input-process-output model.
input and output methods are defined below. These methods are assumed in all algorithms presented in the examination. You do NOT need to study or understand these methods. Their sole purpose is to simplify examination questions.
The AddSub Applet as a console application using the awt.
data members
All applications start with a public static void main(String[] args) method.
Using methods inherited from the Frame parent Class here to set up the application window: user-defined method to add awt objects Inner Classes can be used since Java 1.2 to ease the task of interacting with Application windows. It justs detects when the user clicks the Close window cross and exits the application. This acts just like an init method of an Applet.
The ActionListener interface can be used equally well with applications.
All this looks pretty familiar.
|
Applications are distinct from the Applets we have seen so far, in that: :
/** Sample output of the application (in BlueJ, right-click the Class name and select main() from the menu):
There is no reason why an Application cannot use the awt library Classes if required: import java.awt.*;
Remember that these applications do not run in web pages or the AppletViewer. If you are not using BlueJ then your IDE will provide a method for running main(). If you are using a simple editor like Notepad then you will have to:
If anyone's interested we might add a page showing how to do this using the Windows Command Line and the Ant application. Related: [ Java Core | previous Finally ] |
See also this page. |
|
|
|||
|
Questions or problems related to this web site should be addressed to Richard Jones who asserts his right to be identified as the author and owner of these materials - unless otherwise indicated. Please feel free to use the material presented here and to create links to it for non-commercial purposes; an acknowledgement of the source is required by the Creative Commons licence. Use of materials from this site is conditional upon your having read the additional terms of use on the about page and the Creative Commons Licence. View privacy policy. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. © 2001 - 2009 Richard Jones, PO BOX 246, Cambridge, New Zealand; This page was last modified: May 31, 2009 |