samples/trycatchredo/src/org/apidesign/exceptions/trycatchredo/api/SaveAction.java
Updating to NBMs from NetBeans 8.0.1 as some of them are required to run on JDK8
1 package org.apidesign.exceptions.trycatchredo.api;
3 import java.awt.EventQueue;
4 import java.awt.event.ActionEvent;
5 import java.io.IOException;
6 import java.io.OutputStream;
8 import javax.swing.AbstractAction;
9 import javax.swing.JOptionPane;
13 * @author Jaroslav Tulach
15 final class SaveAction extends AbstractAction {
16 private final URL where;
17 private final CharSequence what;
19 SaveAction(URL where, CharSequence what) {
25 public void actionPerformed(ActionEvent ev) {
26 assert EventQueue.isDispatchThread();
27 // BEGIN: trycatchredo.SaveAction
29 OutputStream os = where.openConnection().getOutputStream();
30 os.write(what.toString().getBytes());
32 } catch (IOException ex) {
33 JOptionPane.showMessageDialog(null, ex);
35 // END: trycatchredo.SaveAction