Using Java Swing GUI, a Ms Paint-like whiteboard application with 4 different colors to draw freehand and an eraser of size 10 radius. Make sure the eraser only enables when the CTRL key is pressed from the keyboard.
You can use DrawArea for paint.
Whiteboard
X
Whiteboard
X
Hold down the Ctrl key to erase
Hold down the Ctrl key to erase
Pick a color
Pick a color
Black Red Green Blue
Black Red Green Blue
Figure 1.
Figure 2.
The application window size is 400x300. The black color is selected by default when the application starts.
A user can choose a different pen color using the radio buttons and draw freely by dragging the mouse on the white canvas area. The drawing should be retained even when a refresh is triggered by hide/show or resize of the window.
Whiteboard
X
Whiteboard
X
Hold down the Ctrl key to erase
Hold down the Ctrl key to erase
Pick a color
Pick a color
Black Red Green Blue
Black Red Green Blue
Figure 3.
Figure 4.
A user can hold down the Ctrl key and drag the mouse to apply the eraser. The eraser is indicated by a small circle, and by dragging the mouse, the area wiped by the eraser will be cleaned (i.e. set to white color). The eraser has a radius of 10.