Lab 1 Java
Final Presentation Minimum:
Make an applet with a menu which lets the user
- allow user to make a choice (at least 4 choices) between drawing at least two graphical objects (one should be a box (as below)) AND two small gifs
- allow the user to edit these objects (move, remove, resize, change color, etc). (Only need move and remove for the gifs)
- cannot use Swing (since it is in the Swing Demo). I want you to code this yourselves!
- don't forget all documentation
Useful Preparation (steps in getting to the final product - not to turn in):
- Create an applet, DrawBox.java that allows the user to draw a box
in your applet space
The upper left corner should be recorded on a mousePressed event.
The lower right corner should be recorded in the mouseReleased event.
At first, do not worry about showing a "rubberband box" as the user
drags the mouse, just draw the final box.
- Make the Drawbox more robust by allowing the user to use the mouse
to set any two points as the diagonal corners of the box.
Think about all the possible combinations of starting and
stopping points a user could enter. How do those translate
into coordinates that drawRect() can use?
- Add support to the "rubberbanding" effect when drawing your
box by using another mouse event: mouseDragged. Like mousePressed
and mouseReleased, you can redefine the mouseDragged method:
public void mouseDragged(MouseEvent e)
{...}
Java generates mouseDragged events when the user presses a mouse
button and moves the mouse before releasing the button.
See
some examples for help when you give up...