Spring 2004 CS0007: Introduction to Computer Programming Assignment 3: Pretty Picture (Applets) |
||||||
Have fun! |
||||||
|
||||||
In this project you will setup a simple applet then modify it. This stands in contrast to the standalone programs we've written so far. You will also have a chance to look at the official Java documentation and use it to your advantage. |
||||||
Setup |
||||||
Rather than writing a program from scratch, in this assignment you will begin with a program provided by the book (FirstApplet.java), then modify it. Here are the steps you need to take to get that applet up and running. As usual, plug in your unixs id where you see "yourid":
|
||||||
What
to do |
||||||
Once you have this applet up and running, you should make some changes. The applet uses two methods: drawLine() and drawOval(). First, you should play around a bit with the coordinates given (the numbers given as arguments to these methods) and observe the changes. Play around with them, draw a few extra lines or ovals. Just get a feel for it. Remember, you have to recompile and copy the new class over each time you want to view a change (up arrow on your keyboard will be very handy here). Now it's your turn to explore. Go to Sun's Graphics Java documentation and find the two methods you just used and read about them. Look around at the other methods and find a few that require simple arguments (some are: drawRect(), fillOval(), drawString() - the second one listed, and so on). Now go change your java code and put some calls in for these new methods. Your final program should use at least two of these other methods (not including drawLine() and drawOval(), although feel free to use them as well). You can draw a picture, make a fancy shape, or do whatever. If you want to change the dimensions available to you, just edit FirstApplet.java. |
||||||
Handing
your work in |
||||||
Make sure you have put your full name in as a comment at the top of your java code and that your userid is included in the class and file names (this is VERY important!).
|
||||||
Suggestions/Hints |
||||||
If you want to play around with colors, you can call g.setColor(Color.blue) for blue, or plug in any other basic color. See the documentation for your choices. This is optional, of course. |
||||||
|