Note that there are some explanatory texts on larger screens.

plurals
  1. POjtextarea does not pop out
    primarykey
    data
    text
    <pre><code>import net.htmlparser.jericho.*; @SuppressWarnings({ "serial", "unused" }) public class RenderToText extends JDialog { static JTextArea _resultArea = new JTextArea(100, 100); JScrollPane scrollingArea = new JScrollPane(_resultArea); private final static String newline = "\n"; int filename = 100; String[] fileName = new String[filename]; public RenderToText(){ for (int i = 0; i &lt; filename; i++) { String fileName = "abc"+i+".txt"; // A File object to represent the filename File f = new File(fileName); f.delete(); } _resultArea.setEditable(false); //Starting to write files try{ FileReader fr = new FileReader( "C:\\Users\\user\\fypworkspace\\FYP\\Link\\abc.txt"); BufferedReader textReader = new BufferedReader(fr); // for each URL, process the URL and render the HTML file int numberofURL = 100; String[] URL = new String[numberofURL]; int a; // For each URL, assign one text file to store the contents // for each URL, extract the URL contents for (a = 0; a &lt; numberofURL; a++) { for (int i = 0; i &lt; numberofURL; i++) { URL[a] = textReader.readLine(); try{ try { try { // Render the text from the HTML file String sourceUrlString = URL[a]; System.out.println("Using argument of \"" + sourceUrlString + '"'); if (sourceUrlString.indexOf(':') == -1) sourceUrlString = "file:" + sourceUrlString; Source source = new Source(new URL(sourceUrlString)); String renderedText = source.getRenderer() .toString(); _resultArea.append("\nSimple rendering of the HTML document:\n" + newline); System.out.println(renderedText+ newline); // Write the rendered text to a text file String filename = ("abc" + i + ".txt"); Writer output = null; String text = renderedText; File file = new File(filename); output = new BufferedWriter(new FileWriter(file)); output.write(text); output.close(); System.out.println("Your file has been written"+ newline); // Count the number of words available in the // rendered text. BufferedReader br = new BufferedReader( new FileReader( "C:\\Users\\user\\fypworkspace\\FYP\\abc" + i + ".txt")); String line = "", str = ""; int count = 0; while ((line = br.readLine()) != null) { str += line + " "; } StringTokenizer st = new StringTokenizer(str); while (st.hasMoreTokens()) { String s = st.nextToken(); count++; } _resultArea.append("File has " + count + " words."+ newline); } catch (UnknownServiceException ex) { System.out.println("The following url cannot be processed"+ newline); } System.out.println("\n"); System.out.println("\n"); System.out.println("\n"); } catch (NullPointerException ex) { System.out.println("End of URL"); System.exit(0); } }catch(IOException ex){ System.out.println("The following url cannot be processed due to the need to login"); } } } }catch (IOException e1) { } JPanel content = new JPanel(); content.setLayout(new BorderLayout()); content.add(scrollingArea, BorderLayout.CENTER); this.setContentPane(content); this.setTitle("TextAreaDemo B"); this.pack(); } public static void main(String[] args) throws IOException { JDialog win = new RenderToText(); win.setVisible(true); } } </code></pre> <p>This code extract the contents of a website. I have use append on the output, however the jtextarea does not come out. It cant run, but it <strong>CANT</strong> transfer the output to the jtextarea. What do i missing ? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload