• Post Reply Bookmark Topic Watch Topic
  • New Topic

JList inside a Fixed width JScrollPane  RSS feed

 
Anne Forumer
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using JDK 1.3, I have a JList inside a JScrollPane:

JScrollPane jsp = new JScrollPane(jList)

How can I set things up so the JScrollPane always appears of fixed specified width irrespective of the contents of JList.

Thanks
 
Pat Hays
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using LayoutManager for the parent JPanel, you could set PreferredSize for the JScrollPane.

jScrollPane1.setPreferredSize(new Dimension(120, 200));
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!