01: import java.awt.*;
02: import javax.swing.*;
03:
04: /**
05: This program demonstrates the use of the image proxy.
06: Images are only loaded when you press on a tab.
07: */
08: public class ProxyTest
09: {
10: public static void main(String[] args)
11: {
12: JTabbedPane tabbedPane = new JTabbedPane();
13: for (int i = 0; i < imageNames.length; i++)
14: {
15: JLabel label
16: = new JLabel(new ImageProxy(imageNames[i]));
17: tabbedPane.add(imageNames[i], label);
18: }
19:
20:
21: JFrame frame = new JFrame();
22: Container contentPane = frame.getContentPane();
23: contentPane.add(tabbedPane);
24:
25: frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
26: frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
27: frame.show();
28: }
29:
30: private static final String[] imageNames =
31: {
32: "devonian.gif",
33: "permian.gif",
34: "jurassic1.gif",
35: "jurassic2.gif",
36: "cretaceous1.gif",
37: "cretaceous2.gif",
38: "cretaceous3.gif",
39: "eocene1.gif",
40: "eocene2.gif",
41: "oligocene.gif",
42: "miocene.gif",
43: "pleistocene.gif"
44: };
45:
46: private static final int FRAME_WIDTH = 500;
47: private static final int FRAME_HEIGHT = 300;
48: }