
CISC 370 Lecture Notes for Class No. 9, March 7, 2000
| Course Home | Prev Lect | Next Lect | Example Progs | Exercise Solns | CoreJava Progs Documentation |
Gen'l Docs | Java 2 APIs | Java Glossary | Term Proj Info |
1. (Due next Tues, March 14) Use the material covered in lecture, the material in chap 7 of Horstmann & Cornell, the java.awt javax.swing packages, and your ingenuity to design a logo for yourself using your intials, name(s), and other features. Center the frame in the middle of the screen and your logo in the center of the frame. Make sure everything stays centered if the frame is resized.
Here is an example of a logo along with its source code that I did for a research project called Linbox. The earlier Delaware applet you did could be considered a simple logo also. But this time, write an application, not an applet. I may ask some of you to demo your code in lecture so come prepared to do that.
To prepare programming assignments for submission, do the following for each exercise.
script // Produces a file named typescript whoami date pwd cat *.java javac *.java // mainFile should be the name of the file containing java mainFile // your main() method exit // to exit script
Now print the typescript file for submittal at the beginning of lecture.
This program is in the files example-progs/helloWorld-app/version2/HelloWorld.java and example-progs/helloWorld-app/version2/HelloWorldPanel.java . Most of the new code is in the paintCompnent() method of the HelloWorldPanel class.
In this newer version of the hello world example, everything is centered. The frame is centered on the display screen, the oval is centered on the paintable surface of the frame, and the message is centered in the oval. Furthermore, if the frame is resized, the oval and message will also resize.
Some things to note about this program.
In this case, the three horizontal lines help us to see various dimensions of the font that we are using. Fonts are fairly complicated objects. Horstmann and Cornell contains a nice discussion of fonts on pp. 281-291 that deserves a careful study.
Back to the
CISC 370 homepage.
This page has been accessed
times since 9 Mar 2000.
Corrections, suggestions and comments to Bob Caviness
Copyright
2000 B. F. Caviness