开发者

How can I display the output of an array list in a popup window using Java?

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".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜