PaintByNumber.java continued

 

Add to PaintByNumber.java that you began.  The graphics features are nearly done, so let’s add interactivity!

Extra credit is possible in this program, but cannot earn you more than 4 points (the program, in total, is worth about 20 points, including the graphics stuff from the earlier steps).  Highest score possible is 24/20.

 

  1. Use the mouse to select a color (dip the paintbrush) and paint the color into a square.  Assume the user will use the numbers drawn in the grid as a guide.  This involves several things:

a)     Distinguish between dipping for color and painting with color; the user should not be able to paint outside of the grid or select a color outside of the paint pots.

b)     A square should be filled completely, covering grey and white, but that square that is clicked on should be filled with the color chosen by the user.  The user should be able to click anywhere within the square to fill it.  Some math to realize to do this:

·       fillHereX = ***.getX()/20*20;

·       fillHereY = ***.getY()/20*20;

  1. When  the mouse is used at the same time that Shift is pressed, have the box on the grid that is chosen appear erased (in other words, fill with white).
  2. Use keyboard events to allow the user to pick which picture will be painted AT THE BEGINNING of the program only.  Be sure to make instructions clear on the screen.
  3. When the mouse is used and Control is pressed AT ANY TIME, the game will relaunch, anew.  This means that the board will be freshly drawn and input can be obtained from the keyboard for a painting image.
  4. Extra credit (Up to 3 points): Add feedback to the user with regards to their painting.  Consider what would be appropriate use of the game, and what is not.  Be sure feedback is clearly displayed and appropriate.
  5. Extra credit (Up to 4 points): Add a scrollbar or slider to the game, so that after the drawing is made, you can slide to change the color balance on the screen.  To do this, you’ll probably want to save the drawing as it is made to an array which records RGB colors at specific positions.  When the scrollbar / slider is used, one or more aspects of RGB change, while the picture is redrawn.  You can use an actual scrollbar or slider for this, or use a mouse slid across a region of the screen (the movable part of the slider can be redrawn to make it look like a slider / scrollbar).