A Default size for a blank JList?

Reply

Join Date: Dec 2004
Posts: 27
Reputation: Frank0051 is an unknown quantity at this point 
Solved Threads: 0
Frank0051 Frank0051 is offline Offline
Light Poster

A Default size for a blank JList?

 
0
  #1
Jan 19th, 2006
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:


  1. playListPanel=new JPanel();
  2. playListPanel.setBorder(new TitledBorder("PlayList"));
  3. playListData=new DefaultListModel();
  4. playListDisplay=new JList();
  5. playListDisplay.setModel(playListData);
  6. playListDisplay.setFixedCellWidth(300);
  7. playListDisplay.setVisibleRowCount(5);
  8. playListDisplay.setDragEnabled(true);
  9.  
  10. playListData.addElement("");
  11. //playListDisplay.setListData(playListData);
  12. scrollPane = new JScrollPane(playListDisplay,
  13. ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
  14. ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
  15. playListPanel.add(scrollPane);

Thanks in advance for the help
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 763
Reputation: Phaelax is on a distinguished road 
Solved Threads: 38
Phaelax Phaelax is offline Offline
Master Poster

Re: A Default size for a blank JList?

 
0
  #2
Jan 20th, 2006
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
When you say size, are you referring to the visual aspect of the component? Cause having the size of a list with 5 elements when its empty doesn't make sense to me.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 27
Reputation: Frank0051 is an unknown quantity at this point 
Solved Threads: 0
Frank0051 Frank0051 is offline Offline
Light Poster

Re: A Default size for a blank JList?

 
0
  #3
Jan 20th, 2006
Yeah I know I didn't make any sense, I figured out my problem though; sorry for the troubles.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC