Overview
In this assignment, you will gain experience with the Model-View-Controller pattern and build an understanding of the inner workings of common user interactions. You will extend the provided SquareDrawerWithDragSelections example discussed in class to create some basic and robust user interactions.
This assignment will consist of 4 distinct smaller parts that can be worked on individually. The other parts do not necessarily rely on one another, although completing Part 1 first, followed by part 2 will make it much easier for you to work on parts 3 and 4.
Part 1: Add a Toolbar
First, start by adding a simple toolbar. The toolbar should provide two sets of buttons that contain only icons (the images are provided in the images directory). Your ToolBar should provide two sets of buttons. The first set are ToggleButtons (representing shapes) that can be drawn in the application. ToggleButtons only allow one option to be selected at a time (when associated with a common ToggleGroup). The leftmost ToggleButton should be depressed by default.
Part 2: Draw Different Shapes
You should finish Part 1 before completing Part 2, to make it easy to select a shape to be drawn. You will extend the application and make it work with shapes of different types. A user will be able to select the button at the top of the app (Square, Circle or Button) and create the correct item. Creating items will work by simply depressing the desired shape button and clicking on an empty part of the canvas (which is the same way squares are created in the provided example).
Shapes should respond precisely to clicks, e.g., a click must fall directly within the shape to count as a click on the shape. Shapes can be clicked and dragged, selected and moved as in the provide example (SquareDrawerWithDragSelections).
Part 3: Simple Cutting and Pasting
In Part 3, you will implement simple cutting and pasting, by attaching actions to the “Cut” and ”Paste” buttons created in Part 1.
Drawn objects should be able to be selected in the same way as was provided in the starting example code. When the cut button is clicked, selected items are cut from the scene. Any operations can then continue with the interface. If the Paste button is clicked, the “cut” items are returned to their original place, and are the active selection. If additional objects are cut while there are already other objects cut, then the previously cut objects are discarded (similar to how normal cut-and-paste works). The Paste button only works once. That is if items are pasted once, clicking Paste again, won’t paste additional copies of the objects to the scene.
Part 4: Rubber-band Drag Selections from Multiple Directions
In Part 4, you will extend the rubber band rectangle selection technique so that drag selections can be done in any direction. In the current example, the Rectangle selection region is drawn from top-left to bottom right only. You will add code so that the region can resize when the mouse is dragged in any direction.


0 comments