开发者

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

开发者 https://www.devze.com 2023-02-25 05:54 出处:网络
Below is what I want to display: JTextArea result = new JTextArea(10,20); ArrayList<String> result_set = gen.getResult();

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

精彩评论

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