Source of IconAdapterTester.java


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

  4: /**
  5:    This program demonstrates how an icon is adapted to
  6:    a component. The component is added to a frame.
  7: */
  8: public class IconAdapterTester
  9: {
 10:    public static void main(String[] args)
 11:    {
 12:       Icon icon = new CarIcon(300);
 13:       JComponent component = new IconAdapter(icon);

 15:       JFrame frame = new JFrame();
 16:       frame.add(component, BorderLayout.CENTER);
 17:       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 18:       frame.pack();
 19:       frame.setVisible(true);
 20:    }
 21: }