[Japi-cvs] SF.net SVN: japi:[1214] historic/trunk/src/doc/guide/swing/action/ fromScratch/src/net/
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2009-03-01 21:21:21
|
Revision: 1214 http://japi.svn.sourceforge.net/japi/?rev=1214&view=rev Author: christianhujer Date: 2009-03-01 21:21:12 +0000 (Sun, 01 Mar 2009) Log Message: ----------- Minor code updates. Modified Paths: -------------- historic/trunk/src/doc/guide/swing/action/fromScratch/src/net/sf/japi/examples/editor/Editor.java Modified: historic/trunk/src/doc/guide/swing/action/fromScratch/src/net/sf/japi/examples/editor/Editor.java =================================================================== --- historic/trunk/src/doc/guide/swing/action/fromScratch/src/net/sf/japi/examples/editor/Editor.java 2009-03-01 21:08:45 UTC (rev 1213) +++ historic/trunk/src/doc/guide/swing/action/fromScratch/src/net/sf/japi/examples/editor/Editor.java 2009-03-01 21:21:12 UTC (rev 1214) @@ -6,6 +6,8 @@ import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.io.Reader; +import java.io.Writer; import java.util.HashMap; import java.util.Map; import javax.swing.Action; @@ -91,9 +93,10 @@ if (fileChooser.showOpenDialog(frame) == APPROVE_OPTION) { final StringBuilder newText = new StringBuilder(); final File newFile = fileChooser.getSelectedFile(); - final FileReader in = new FileReader(newFile); + final Reader in = new FileReader(newFile); try { final char[] buf = new char[4096]; + //noinspection NestedAssignment for (int charsRead; (charsRead = in.read(buf)) != -1; ) { newText.append(buf, 0, charsRead); } @@ -119,7 +122,7 @@ if (file == null) { fileSaveAs(); } else { - final FileWriter out = new FileWriter(file); + final Writer out = new FileWriter(file); try { out.write(textPane.getText()); } finally { @@ -134,7 +137,7 @@ @ActionMethod public void fileSaveAs() throws IOException { if (fileChooser.showSaveDialog(frame) == APPROVE_OPTION) { final File newFile = fileChooser.getSelectedFile(); - final FileWriter out = new FileWriter(newFile); + final Writer out = new FileWriter(newFile); try { out.write(textPane.getText()); file = newFile; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |