0

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

それの何が悪いのですか? ここに画像の説明を入力

4

0 に答える 0