Assuming that your jsoup works and that your for each loop prints out the tags that you need.... I have written up some code that prints the contents of an arraylist to a TextArea using Java swing. The only thing that I did different from you is use Strings instead of Elements (because I dont have the jsoup library downloaded.
class stackExchangeHelp
package stackExchangeHelp;
import java.util.ArrayList;
public class stackExchangeHelp
{
public static void main(String[] args)
{
//this should be a list of elements (not strings)
ArrayList<String> listToSend = new ArrayList<String>();
//use your for each loop to add elements to the list
listToSend.add("First element");
listToSend.add("Second Element");
listToSend.add("Third Element");
DisplayGuiHelp gui = new DisplayGuiHelp(listToSend);
}
}
class DisplayGuiHelp
package stackExchangeHelp;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
public class DisplayGuiHelp
{
public DisplayGuiHelp(ArrayList<String> list) //constructor of the DisplayGuiHelp object that has the list passed to it on creation
{
final JFrame theFrame = new JFrame();
theFrame.setTitle("Stack exchange help");
theFrame.setSize(500, 500);
theFrame.setLocation(550, 400);
JPanel mainPanel = new JPanel();
JTextArea theText = new JTextArea(5,25); //create the text area
for(String text : list)
{
theText.append(text + "\n"); //append the contents of the array list to the text area
}
mainPanel.add(theText); //add the text area to the panel
theFrame.getContentPane().add(mainPanel); //add the panel to the frame
theFrame.pack();
theFrame.setVisible(true);
}
}
Let me know if you have any questions or would like me to expand upon it more.