Ljava.lang.Object;无法强制转换为java.lang.String

时间:2015-07-17 06:16:00

标签: java

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;

任何帮助都会很愉快:)

0 个答案:

没有答案