DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: more applets

  1. #1
    Join Date
    Mar 2005

    Exclamation more applets

    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 . . .

  2. #2
    Join Date
    Mar 2005
    figured the 1st applet out, any help on the 2nd would be very appreciated!

    thanks . . .

  3. #3
    Join Date
    Nov 2004
    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.
    eschew obfuscation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.