//******************************************************************** // TransitMap.java Authors: Lewis/Loftus // // Demonstrates the use a scroll pane. //******************************************************************** import java.awt.*; import javax.swing.*; public class TransitMap { //----------------------------------------------------------------- // Presents a frame containing a scroll pane used to view a large // image of a Philadelphia subway system map. (SEPTA stands for // the SouthEast Pennsylvania Transit Authority) //----------------------------------------------------------------- public static void main (String[] args) { JFrame frame = new JFrame ("SEPTA Transit Map"); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); ImageIcon image = new ImageIcon ("septa.jpg"); JLabel imageLabel = new JLabel (image); JScrollPane sp = new JScrollPane (imageLabel); sp.setPreferredSize (new Dimension (450, 400)); frame.getContentPane().add (sp); frame.pack(); frame.show(); } }