Hello, I'm currently creating a PlayList for a media application I am working on. I'm using a JList as the GUI object for the PlayList and a DefaultListModel as the storage area to be held in the PlayList. I was hoping that if I was to pass a DefaultListModel object containing no information I could create a JList that had, lets say, 5 rows visible how that doesn't seem to be the case. Overall I'm hoping that I can have the playlist (JList) stay the same size whether their is data in the DefaultListModel or if it is completely empty (like a new playlist. Basically the playlist would sort of work like Winamp's. Below is some of the code I'm using:
playListPanel=new JPanel();
playListPanel.setBorder(new TitledBorder("PlayList"));
playListData=new DefaultListModel();
playListDisplay=new JList();
playListDisplay.setModel(playListData);
playListDisplay.setFixedCellWidth(300);
playListDisplay.setVisibleRowCount(5);
playListDisplay.setDragEnabled(true);
playListData.addElement("");
//playListDisplay.setListData(playListData);
scrollPane = new JScrollPane(playListDisplay,
ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
playListPanel.add(scrollPane);
Thanks in advance for the help