Question: Paint with Dots java For Lab 2, you're modifying the Dots and DotsPanel classes from your text to make a simple Paint program. Modify the

Paint with Dots java

For Lab 2, you're modifying the Dots and DotsPanel classes from your text to make a simple Paint program. Modify the program to

  1. Paint with continuous dots by adding a MouseMotionListener that adds points to the pointsList when the mouseDragged event is triggered.
  2. Add some color to the dots by changing the page.setColor(...). A hint is given below.

/* HINTS: For random-colored dots, generate three random numbers R, G, and B between 0 and 1.0 (or 0 and 255 integer) and use:

page.setColor(new Color(R,G,B)); //before drawing each dot, individually

For something more fluid, use a counter/iterator variable, and change the color based on that iterator, multiplying or adding it and modding by 256 (for each Red, Green, Blue component):

page.setColor(new Color(i%255, (i*2)%255, (i+128)%255); // really slick :) - play with multiples/adds */

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!