private static String[] food = {"bacon", "wings", "ham", "beef","morebaken"};
public MultipleSelLis(){
leftlistik = new ArrayList<String>(Arrays.asList(food));
leftlist = new JList(leftlistik.toArray());
leftlist.setVisibleRowCount(3);
add(new JScrollPane(leftlist));
rightlistik = new ArrayList<String>();
movebutton = new JButton("Move -->");
movebutton.addActionListener(
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
rightlistik.add(leftlist.getSelectedValues());
leftlistik.remove(leftlist.getSelectedValues());
righrlist.setListData(rightlistik.toArray());
}
}
);
add(movebutton);
add(returnbutton);
righrlist = new JList();
add(new JScrollPane(righrlist));
}
}
当我选择buttom进入&#34; righrlist&#34;像&#34; [Ljava.lang.Object; @ ...&#34;
任何帮助都会很愉快:)