diff -r 000000000000 -r 0678c9589013 samples/trycatchredo/src/org/apidesign/exceptions/trycatchredo/api/SaveAction.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/trycatchredo/src/org/apidesign/exceptions/trycatchredo/api/SaveAction.java Sun Feb 01 16:29:46 2009 +0100 @@ -0,0 +1,35 @@ +package org.apidesign.exceptions.trycatchredo.api; + +import java.awt.EventQueue; +import java.awt.event.ActionEvent; +import java.io.IOException; +import java.io.OutputStream; +import java.net.URL; +import javax.swing.AbstractAction; +import javax.swing.JOptionPane; + +/** + * + * @author Jaroslav Tulach + */ +final class SaveAction extends AbstractAction { + private final URL where; + private final CharSequence what; + + SaveAction(URL where, CharSequence what) { + this.where = where; + this.what = what; + } + + + public void actionPerformed(ActionEvent ev) { + assert EventQueue.isDispatchThread(); + try { + OutputStream os = where.openConnection().getOutputStream(); + os.write(what.toString().getBytes()); + os.close(); + } catch (IOException ex) { + JOptionPane.showMessageDialog(null, ex); + } + } +}