Below is what I want to display:
JTextArea result = new JTextArea(10,20);
ArrayList<String> result_set = gen.getResult();
for(Iterator it = result_set.iterator(); it.hasNext();)
{
String data = (String)it.next();
res开发者_开发百科ult.append(data+"\n");
}
How can I put a JTextArea
in a popup window?
First you would add the JTextArea to a JScrollPane.
You can then add the scrollpane to a JPopupMenu.
Or you can add the scrollpane to a JOptionPane.
Read the Swing tutorial for more information. There are sections on "How to Use Menus" and "How to Make Dialogs".
精彩评论