java选择框,Java多选选择对话框

I have a dialog box with a drop down menu like this:

Object[] possibilities = {"1", "2", "3", "4"};

ImageIcon icon = new ImageIcon("images/middle.gif");

int i = Integer.parseInt((String)JOptionPane.showInputDialog(pane,"How Many Channels:","Reset Visible Channels",

JOptionPane.PLAIN_MESSAGE,icon,possibilities,"1"));

The problem is that it only lets you select one option. Instead, I would like

for users to be able to select multiple options from a list that is given in

the dialog box. Something like the following:

Object[] possibilities = {"apples", "oranges", "lemons", "grapes"};

ImageIcon icon = new ImageIcon("images/middle.gif");

String s = (String)what do i put here instead of JOptionPane.showInputDialog(); ?

Can anyone show me how to alter this code so that it does what I am asking?

It would be nice to know what some of my various format options are. And I would really appreciate any links to some good articles on the topic. The articles I have found from my google searches are not very informative. I might be using the wrong key words.

解决方案

JList is also a good alternative for multiple selections.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值