Web site hosting - Java Swing - O Reilly class OpenAction extends AbstractAction
Java Swing - O Reilly class OpenAction extends AbstractAction { public OpenAction() { super(”Open”, new ImageIcon(”icons/open.gif”)); } // Query user for a filename and attempt to open and read the file into the// text componentpublic void actionPerformed(ActionEvent ev) { String filename = JOptionPane.showInputDialog( SimpleEditor.this, “Enter Filename”); if (filename == null) return; FileReader reader = null; try { reader = new FileReader(filename); textComp.read(reader, null); } catch (IOException ex) { JOptionPane.showMessageDialog(SimpleEditor.this, “File Not Found”, “ERROR”, JOptionPane.ERROR_MESSAGE); } finally { if (reader != null) { try { reader.close(); } catch (IOException x) {} } } } } // An action that saves the document to a fileclass SaveAction extends AbstractAction { public SaveAction() { super(”Save”, new ImageIcon(”icons/save.gif”)); } // Query user for a filename and attempt to open and write the text // component’s content to the file public void actionPerformed(ActionEvent ev) { String filename = JOptionPane.showInputDialog( SimpleEditor.this, “Enter Filename”); if (filename == null) return; FileWriter writer = null; try { writer = new FileWriter(filename); textComp.write(writer); } catch (IOException ex) { JOptionPane.showMessageDialog(SimpleEditor.this, “File Not Saved”, “ERROR”, JOptionPane.ERROR_MESSAGE); } finally { if (writer != null) { try { writer.close(); } catch (IOException x) {} } } } - 802
We recommend high quality webhost to host and run your jsp application: christian web host services.