import java.awt.*; import javax.swing.*; /** * Image manipulating program. *

* This program allows the you to display images (gif or jpg, or anything * supported by Java). Images are specified using a file dialog, but a simple * modification would allow the user to use an http: URL (currently a file: URL * is used) *

* Current image processing is simple: reflect horizontally/vertically and * invert (change black-to-white or vice-versa, and do the right thing with * color pixels, e.g., red = 255 - red). * * @author Robert Duvall (rcd@cs.duke.edu) * @author Owen Astrachan (ola@cs.duke.edu) */ public class Main { public static final Dimension SIZE = new Dimension(800, 600); public static final String TITLE = "Pixmap!"; public static void main (String[] args) { // create container that will work with Window manager JFrame frame = new JFrame(TITLE); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // create GUI components PixmapCanvas canvas = new PixmapCanvas(frame); ButtonPanel commands = new ButtonPanel(canvas); // add commands to test here commands.add(new Reader()); commands.add(new Negative()); commands.add(new Expand()); commands.add(new MirrorVertically()); commands.add(new MirrorHorizontally()); commands.add(new Blur()); commands.add(new Sharpen()); // add our container to Frame and show it frame.getContentPane().add(canvas, BorderLayout.CENTER); frame.getContentPane().add(commands, BorderLayout.NORTH); frame.pack(); // start the GUI frame.show(); } }