Java Reference
In-Depth Information
Figure 11.2
A simple
image-viewer
application
Java calls these top-level windows frames. In Swing, they are represented by a class called
JFrame .
Code 11.1
A first version of an
ImageViewer class
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
// Comment omitted.
public class ImageViewer
{
private JFrame frame;
/**
* Create an ImageViewer and show it on screen.
*/
public ImageViewer()
{
makeFrame();
}
/**
* Create the Swing frame and its content.
*/
private void makeFrame()
 
Search WWH ::




Custom Search