01: import java.awt.*;
02: import javax.swing.*;
03:
04: /**
05: This program demonstrates how an icon is adapted to
06: a component. The component is added to a frame.
07: */
08: public class IconAdapterTest
09: {
10: public static void main(String[] args)
11: {
12: Icon icon = new CarIcon(300);
13: JComponent component = new IconAdapter(icon);
14:
15: JFrame frame = new JFrame();
16: Container contentPane = frame.getContentPane();
17: contentPane.add(component, BorderLayout.CENTER);
18: frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
19: frame.pack();
20: frame.show();
21: }
22: }