Show Your Code #8

Pick one of the following problems to do for your Show Your Code.

1. Follow the Mouse - Make a JavaFX application where a simple geometric shape follows the mouse around. Note that I don't want it to be at the location of the mouse for this as we did that in class. Instead, I want it to move from where it is toward the location of the mouse. This works best with an AnimationTimer.

2. Keyboard Control - Make a JavaFX application that has a simple geometric shape that moves around when you press keys. We did this in a basic way in class, but that didn't allow diagonal motion. To enable diagonal motion, you make four boolean variables that tell you if a key is being held down. In setKeyPressed you would set the appropriate boolean to true (something like upPressed = true; if you named your variable upPressed). In setKeyReleased you would set it back to false. In the AnimationTimer, you have if statements that check those boolean variables and actually move the shape around.

3. Drawing Lines - Make an applet that allows the user to draw lines using the mouse. How exactly you do this up to you.