Java Graphics  «Prev 

Additional Information reading Images

public boolean drawImage 
(Image img, int x, int y , ImageObserver observer)

  1. The first three parameters to drawImage() specify the Image object to be drawn, along with its XY position.
    The image is drawn with its upper left corner at this position.
  2. The last parameter, observer, is a special object used to keep track of the image as it is being loaded.

JFC Frame

Within the frame, you will want to place other components that make upyour application's user interface. Before you can begin building your interface, you need to know how you can control and customize these components.You will look at the properties that all of the Swing components expose and see the difference between a simple component and a container. You will also have a brief look at the job of the layout manager, which controls the locations of components within containers, in preparation for a thorough discussionof this topic in the next chapter. The second part of this chapter takes a close look at two of the simplestbut most commonly used Swing components labels and buttons.
The Swing versions of these components are more powerful than their AWT counterparts because, among other things, they can display images as well as text. In the course of discussing these components, you will l find a review of the AWT event model and you will see how the Swing Imagelcon class makes it much easier than ever before to load images for use with labels and buttons.

JFrame Class

When you start any Java program with a graphical user interface (GUI), you see a window where the application will display its output and into which the user will type input with the keyboard or point and click with the mouse. When you use the Swing components, this top-level window is an instance of the class j avax. swing. JFrame. Like some of the other Swing components, including the other Swing top-level windows JDialog and JWindow, JFrame is derived from an AWT control. Components that are introduced in this module are related to each other and to the heavyweight AWT controls that you are familiar with.