I am trying the RSS Feed code from this website (http://javamix.wordpress.com/category/programs/rss-feed/) It worked fine. I would like to display results in GUI instead. I’ve created a JTextArea to append the elements but the results is ‘loaded’ instead of being listed out. Thanks.
Original:
System.out.println("Title: " + getElementValue(element,"title"));
System.out.println("Link: " + getElementValue(element,"link"));
System.out.println("Publish Date: " + getElementValue(element,"pubDate"));
I’ve created a JTextArea to display the result:
for (int i-0; i<nodes.getLength();i++)
{
Element element = (Element)nodes.item(i);
JTextArea textArea = new JTextArea();
textArea.setBounds(10, 11, 864, 540);
textArea.setWrapStyleWord(true);
getContentPane().add(textArea);
textArea.append("Title: " + getElementValue(element,"title") + "\n");
textArea.append("Link: " + getElementValue(element,"link") + "\n");
textArea.append("Publish Date: " + getElementValue(element,"pubDate") + "\n");
}
I’m a new user and not allowed to upload pictures, but there’s the link 🙂 I need a full list of results, displayed in the GUI.
My result (Title, Link, Publish Date remains static while the result was loaded) >>> Refer Screenshot My Result
Console (A full list of result) >>> Refer Screenshot Console
You are making a new
TextAreaevery time in the Loop.Move the declaration and instatiation of the
TextAreato before the loop.Like this: