Source of ProxyTester.java


  1: import java.awt.*;
  2: import javax.swing.*;

  4: /**
  5:    This program demonstrates the use of the image proxy.
  6:    Images are only loaded when you press on a tab.
  7: */
  8: public class ProxyTester
  9: {
 10:    public static void main(String[] args)
 11:    {
 12:       JTabbedPane tabbedPane = new JTabbedPane();
 13:       for (String name : imageNames)
 14:       {
 15:          JLabel label = new JLabel(new ImageProxy(name));
 16:          tabbedPane.add(name, label);
 17:       }

 19:       JFrame frame = new JFrame();
 20:       frame.add(tabbedPane);

 22:       frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
 23:       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 24:       frame.setVisible(true);
 25:    }

 27:    private static final String[] imageNames =
 28:    {
 29:       "devonian.gif",
 30:       "permian.gif",
 31:       "jurassic1.gif",
 32:       "jurassic2.gif",
 33:       "cretaceous1.gif",
 34:       "cretaceous2.gif",
 35:       "cretaceous3.gif",
 36:       "eocene1.gif",
 37:       "eocene2.gif",
 38:       "oligocene.gif",
 39:       "miocene.gif",
 40:       "pleistocene.gif"
 41:    };

 43:    private static final int FRAME_WIDTH = 500;
 44:    private static final int FRAME_HEIGHT = 300;
 45: }