我想将列表播放器显示给Jlist,但它不会显示所有列表,最后只显示2个元素。 这是我的代码:
//create List player
listplayersource = new DefaultListModel();
listplayersource.addElement("VIP player 1");
list_player = new JList(listplayersource);
list_player.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list_player.setLayoutOrientation(JList.VERTICAL);
list_player.setVisibleRowCount(16);
panelmain.add(new JScrollPane(list_player), BorderLayout.WEST);
listplayersource.addElement("Vip player 2");
listplayersource.addElement("VIP player 2");
listplayersource.addElement("VIP player 3");
listplayersource.addElement("VIP player 4");
listplayersource.addElement("VIP player 5");
结果:
VIP player 4
VIp player 5
它出了什么问题?