String text = buf.toString(); pane.setContentType("text/html"); pane.setText(text); } finally { try { if (in != null) in.close(); } catch (IOException e) { } } }
Pattern pattern = Pattern.compile("@VERSION@"); String line; while ((line = reader.readLine()) != null) { line = pattern.matcher(line).replaceAll(Version.RELEASE); buf.append(line); buf.append('\n'); }   String text = buf.toString(); pane.setContentType("text/html"); pane.setText(text); } finally { try { if (in != null) in.close(); } catch (IOException e) { } } }
    private void processPage(javax.swing.JEditorPane pane, String fileName) throws IOException {        InputStream in = null;                try {            StringBuffer buf = new StringBuffer();            // Open the file as a stream            in = getClass().getClassLoader().getResourceAsStream(fileName);            if (in == null)                throw new IOException("Couldn't load " + fileName);            BufferedReader reader = new BufferedReader(new InputStreamReader(in));            // Replace instances of @VERSION@ with actual version number            Pattern pattern = Pattern.compile("@VERSION@");            String line;            while ((line = reader.readLine()) != null) {                line = pattern.matcher(line).replaceAll(Version.RELEASE);                buf.append(line);                buf.append('\n');            }            // Load the page into the editor pane            String text = buf.toString();            pane.setContentType("text/html");            pane.setText(text);        } finally {            try {                if (in != null)                    in.close();            } catch (IOException e) {            }        }    }