For this assignment you will create a simple vector graphics drawing program like Adobe Illustrator or the open source Inkscape. A vector graphics program is different from a raster graphics program in that all objects that are drawn to a scene are stored parametrically instead of in a raster image, like in Adobe photoshop or Microsoft Paint. Storing objects this way allows the user of the program to zoom without losing detail and to more easily edit objects that have already been added. However, it also requires that the scene be re-rendered to a raster image for display every time a change is made.
paint
method
to draw the object of each particular class.main
method and displays the window for the
program. The window's main panel should contain two sub-panels.
The Left sub-panel should contain radio buttons, aligned
vertically, that represent the current tool that is selected by
the user (oval, rectangle, or line). You can use the images in
the tar file DrawIcons.tar.gz for
the radio buttons. The right sub-panel should be where the user
can draw and, therefore, should override
the paintComponent
method.paintComponent
method should paint every shape in
the array list.Submission: Submit your code as a zip file with your name as the zip file name on the course Inquire site.
Erase
The vector drawing program delays converting the drawing into a raster until it is drawn to the window. This has several advantages over a raster based drawing programs. For example, it is possible to remove shapes without using an eraser tool that erases everything. Add to the drawing program a button that when pressed removes the most recently drawn shape by removing it from the list of shapes and redrawing the window.
Zoom
Another thing that vector drawing programs can do that raster programs can not is change the zoom at which the drawing is viewed. Add to the drawing program a button that when pressed zooms in on the drawing. In order to zoom, the coordinates the shapes do not need to be changed. Instead their coordinates as they are drawn can be modified. For example, if the image is zoomed to double magnification, then the line width and all of the coordinates should be doubled.