public void load ( ) { int resp = loadChooser . showOpenDialog ( this ) ; if ( resp == JFileChooser . APPROVE_OPTION ) { lastSelected = loadChooser . getSelectedFile ( ) ; saveChooser . setCurrentDirectory ( loadChooser . getCurrentDirectory ( ) ) ; try { BufferedImage image = ImageIO . read ( lastSelected ) ; imagePanel . setImage ( image ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; JOptionPane . showMessageDialog ( this , "Unable to load image " + lastSelected . getName ( ) + " " ) ; } } }
Load the current image