private void save ( ) { int resp = saveChooser . showSaveDialog ( this ) ; if ( resp == JFileChooser . APPROVE_OPTION ) { File out = saveChooser . getSelectedFile ( ) ; ArrayList list = new ArrayList ( ) ; for ( int i = 0 ; i < sprites . size ( ) ; i ++ ) { list . add ( sprites . elementAt ( i ) ) ; } try { int b = ( ( Integer ) border . getValue ( ) ) . intValue ( ) ; pack . packImages ( list , twidth , theight , b , out ) ; } catch ( IOException e ) { // shouldn't happen e . printStackTrace ( ) ; JOptionPane . showMessageDialog ( this , "Failed to write output" ) ; } } }
Save the sprite sheet