You can click the panel to create various objects as specified by the menu items. Objects have from 1 to 4 vertices. When you change color options, they are implemented on the current shape and future shapes. However, if you change shape after giving the current figure any points, you will need to complete it before the new shape is implemented.
Note: when drawing multiple points objects, the sketch starts the drawing by using the points it currently has available. I.e. a line is drawn after the second point is clicked, and a triangle is drawn after the third point even if the final figure is a quadrilateral.
The sketch remembers the last 10 figures drawn.
Display sketch code: DrawingMenu.pde
ClickablePanel | The panel in the center. |
Button | Explicitly created for LineColor and Options Menus and implicitly created for the other menus. |
Checkbox | The FillShape Checkbox in the Option Menu. |
Menu | "Point Color", "Fill Color", and "Background Color" menu items were created by the first constructor, "Shape" by the second constructor, while "Options" and "Line Color" were created by the third constructor. |
ButtonGroup | Explicitly created for the Options Menu and LineColor Menu. Implicitly created by the other menu items. |
ClickableGroup | All the Menu items are in a ClickableGroup. |
MenuBar | The menu bar. |
Revised: 04/11/2014