my programming professor decided to throw on a couple more programs over the holiday season.

the first one deals with using the drawLine method from Graphics to get a digit from the user and draw the specified digit. Also, there need to be radio buttons to change the color of the digit.

the second one involves drawing shapes. the shapes (circle, rectangle, oval) are selected using a combo box. the user needs to also control the colors of the shapes using radio buttons, & the number of shapes (1, 10, 20, 30, 40) from a combo box. when the shapes are drawn, they need to be offset like 15 units to the right & 15 units down.

any help would be greatly appreciated . . .

03-29-2005, 08:43 AM

eddoPCT

figured the 1st applet out, any help on the 2nd would be very appreciated!

thanks . . .

03-29-2005, 06:10 PM

sjalle

First you make a Panel extension and override its paint method ao you can draw
the shapes.

The first one calls for static array of shapes, e.g with the element for a 'one' being
a set of points like:
[0][0][2,0][],[2,8],[0][8] (just a tall rectangle..)

and so on.

The in the panel paint method you use the drawline method to draw from
point to point in the selected element. If you are going to fill a shape with a
color the easiest way is to use the Polygon class.

The second one involves gridding, that too is done in the paint method w.
nested for loops, x-step, y-step etc. etc. For storing the users combobox
selections and colors i would have used an arraylist and looped though that
during the paint job, but first I would have made myself a little class
for holding two properties: shape & color, and used the arryslist for holding
instances of this class.