In this chapter we will look at how you can draw using the Java 2D facilities that are part of JFC. We will see how to draw in an applet and in an application. We will investigate how we can combine the event-handling capability that we learned about in the previous chapter with the drawing facilities we'll explore in this chapter, so that we can implement an interactive Graphical User Interface for creating a sketch.
By the end of this chapter you will have learned:
What components are available for creating a GUI.
How coordinates are defined for drawing on a component.
How you implement drawing on a component.
How to structure the components in a window for drawing.
What kinds of shapes you can draw on a component.
How you implement mouse listener methods to enable interactive drawing operations.