import java.awt.Color; import java.io.File; import java.io.IOException; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import princeton.Picture; /** * Starter class for Compsci 100, Fall 2009 * * @author YOUR_NAME_HERE * */ public class ExtractImage { protected static JFileChooser ourOpenChooser = new JFileChooser(System .getProperties().getProperty("user.dir")); public static void main(String[] args) throws IOException { ourOpenChooser.setDialogTitle("Choose Hidden Image File"); int action = ourOpenChooser.showOpenDialog(null); if (action == JFileChooser.APPROVE_OPTION) { File f = ourOpenChooser.getSelectedFile(); String fname = f.getCanonicalPath(); String sbits = JOptionPane.showInputDialog( "# bits used for hiding", "2"); int bits = Integer.parseInt(sbits); Picture source = new Picture(fname); ExtractImage extractor = new ExtractImage(); source.show(); } } }