|
Bikle.com web Portfolio: http://VietEnglish.com http://Edgar411.com http://ForumGrouper.com http://hpricot.com
Ajax Demo:
Categories
of
URLs
Plain HTML
(no Ajax here): Categories:
|
TThier/Languages/java/bikleDemo1/ Dan Bikle This page documents some simple Java classes associated with simple Java training. This page would be good for someone in a hurry. It would be good for someone with some previous programming experience who wants to jump into some Java code right away. If you have several days of free time, a very good Java tutorial may be found here: http://java.sun.com/tutorial/ Before you go there, look at the simple demos I have constructed. Some goals of my demos are listed below: ooooooooooooooooooooooooooooooooooooooooooooooooooooo Write a program that will allow the user to: . Enter some numbers (decimal or integer) . Display the Average of those numbers . Display the Smallest and the largest ooooooooooooooooooooooooooooooooooooooooooooooooooooooooo Here are links to a list of Java classes which were written to achieve the above goals: Proj1Array-java.txt Mainproj1Array-java.txt FromKeyBoard-java.txt P27a1Gui-java.txt MainP27a1-java.txt Proj1WindowControl-java.txt Here is a screen dump of compiling and running the character UI portion of the demo: charUIscreenDump.txt Descriptions of the above links are listed below: Proj1Array ---------- This class is the most important class. It constructs an array to hold real numbers. Also it contains some methods which are aptly named: Proj1Array.addToArray(double aNum) Proj1Array.displayArray() Proj1Array.avgOfArray() Proj1Array.minOfArray() Proj1Array.maxOfArray() Mainproj1Array -------------- This class acts as a simple command-line-character interface. It allows the user to interact with the proj1Array class. An obvious enhancement which should be made to the class is the introduction of some error checking. After the author has gained experience with Java error handling techniques (try-catch-finally) he may enhance Mainproj1Array at that time. FromKeyBoard ------------- This class provides some methods for reading data from the command line. P27a1Gui -------- This class acts as a GUI for the user to interact with the Proj1Array class. The interaction model is this: -User reads instructions from insJTextField -User types a number into numJTextField -User types 'add' into cmdJTextField -The action listener detects action in cmdJTextField and fires actionPerformed() -actionPerformed() branches to Xproj1Array.addToArray() -User adds more numbers, actionPerformed() calls Xproj1Array.addToArray() more times -User types 'done' into cmdJTextField -actionPerformed() branches to code path which executes these methods: arrayJTextField.setText(arrayAsString); avgJTextField.setText(avgAsString); minJTextField.setText(minAsString); maxJTextField.setText(maxAsString); -User types 'quit' into cmdJTextField -actionPerformed() branches to System.exit(0); MainP27a1 --------- This is a simple class to create the above P27a1Gui. The guts of this class are held within a single statement: P27a1Gui aP27a1Gui = new P27a1Gui(); Proj1WindowControl ------------------ This class allows the user to shut down MainP27a1.java by clicking the X in the JFrame. Its object is created by the p27a1Gui class via the statement listed below: Proj1Frame.addWindowListener(new Proj1WindowControl( )); After writing and testing the above classes, I used a utility named "javadoc" to generate documentation for the above classes. A screen dump of me running the javadoc utility is linked below: javadoc.txt The javadoc utility generated HTML documentation for the above classes. That documentation is linked below: javadoc/index.html |
|
|
http://bikle.com |
Built With Rails |
4096 Color Wheel |