I am having some issues getting my programs to run. Basically step 1 of my program is to use the JFileChooser to open up an image and make it into a buffered image, simple enough right? this is what I have:
JButton open = new JButton();
JFileChooser fc = new JFileChooser();
File selectedFile = fc.getSelectedFile();
fc.setDialogTitle("Please choose an image...");
FileNameExtensionFilter filter = new FileNameExtensionFilter("JPEG", "jpeg", "jpg", "png", "bmp", "gif");
BufferedImage origImage = null;
String path = "";
File f = fc.getSelectedFile();
boolean exists = false;
fc.addChoosableFileFilter(filter);
try {
f = fc.getSelectedFile();
exists = f.exists();
path = f.getAbsolutePath();
origImage = ImageIO.read(new File(path));
}
catch(Exception e) {
System.out.println(e);
System.exit(0);
}
im getting a null pointer exception (caught by my catch statement) I think it has something to do with the getbsolutepath, but im not sure. Any ideas? Thanks!