//file: Smoothie.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Smoothie {
public static void main(String[] args) {
String imageFile = "L1-Light.jpg";
if (args.length > 0)
imageFile = args[0];
Image i = Toolkit.getDefaultToolkit( ).getImage(
TerribleFlicker.class.getResource(imageFile));
JFrame f = new JFrame("Smoothie");
Container content = new JPanel(new BorderLayout( )) {
public void update(Graphics g) { paint(g); }
};
content.add(new LimitedFlicker(i), BorderLayout.CENTER);
f.setContentPane(content);
f.setSize(300, 300);
f.setLocation(100, 100);
f.addWindowListener(new WindowAdapter( ) {
public void windowClosing(WindowEvent e) { System.exit(0); }
});
f.setVisible(true);
}
}
|