Practice building objects and calling methods by using the textbook's
wheels package to draw a simple picture.
First of all, you'll need the
wheels package: truewheels.jar. (You can also download the source code files too, which can give you javadoc pop-ups in Eclipse). You may also want to see the documentation. [Note:
truewheels.jar contains .class files that match the source code and documentation. The primary difference from the orginally posted wheels.jar is that it uses
java.awt.Color, rather than
If you're using Eclipse, you'll need to add the .jar file as a Library when you create the project for this assignment. If you forget to do this during project creation, you can do it later by going to Project -> Properties, Java Build Path, and then to the Libraries tab. Then Add External Jar...
If you're working on the command line, just put the
wheels.jar in the same directory as your source code. Then you can compile and run like this:
javac -cp ".;wheels.jar" Assignment2.java
java -cp ".;wheels.jar" Assignment2
Once you have that in place, use the shapes provided by
wheels to build a simple picture. You must use at least 3 different shapes in your scene. Possible shapes include Rectangles, Ellipses, Lines, and ConversationBubbles. (There are also Images, if you want to mess around with those.)
Here's an example. This is the first part of the code used, to give you an example: Assignment 2.
Remember to create a new Frame object first, in order to generate a window. You can ignore all the exceptions output that the Frame generates on the console.
What to Submit
Attach your .java file to an email. You don't need to send me
wheels.jar, but remember to include any other files needed to run your program (such as any required files if you used an Image).
Out of 10 points:
- 1 - Submission
- Follows required submission policies.
- 6 - At least 3 different kinds of shapes used in image
- 2 - Images do not use only default settings
- You should use the objects' methods to change at least some of the default values, such as size, location, color, etc.
- 1 - Composition
- You should create some sort of semi-coherent image or scene, even if very simple. Don't just throw a bunch of random shapes on the screen.