Home > Articles

  • Print
  • + Share This
This chapter is from the book

Q&A

  1. Does a threaded animation program have to use Thread.sleep() to pause, or can you omit it to produce the fastest possible animation?

  2. You have to put some kind of pause in place in an animation program, or the program will crash or behave erratically. Without pauses, Java won't be able to keep up with constant repaint() requests and may be unable to respond to mouse-clicks on its interface and other user input. Part of the process of animation design in Java is finding the right display speed that all environments can handle.

  3. What happens if you draw something, such as an image, to coordinates that aren't within the window?

  4. Methods that draw something to a coordinate will continue to draw it even if none of it is visible within the area shown by the applet window or application frame. This is a good way to have something move into view, because the portion of the image that falls into the visible area will be displayed.

  • + Share This
  • 🔖 Save To Your Account