Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help to set horizontal bar to JList

 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am using JList and I want horizontal scroll bar so I used following code . It shows horizontal bar but not exactly scrollbar. I cann't scroll horizontal.


I used setPrototypeCellValue to fix width of JList . I am unable to see remaining part of the list. That is why I want horizontal scroll bar.

Thanks

Vaishali
 
Rob Spoor
Sheriff
Pie
Posts: 20550
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please post an SSCCE?
 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help me
 
Rob Spoor
Sheriff
Pie
Posts: 20550
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not without an SSCCE.
 
Vaishali Paramane
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you want me to post whole code?


 
Rob Camick
Ranch Hand
Posts: 2600
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Rob Spoor
Sheriff
Pie
Posts: 20550
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From that method's Javadoc info:
Sets the prototypeCellValue property, and then (if the new value is non-null), computes the fixedCellWidth and fixedCellHeight properties by requesting the cell renderer component for the given value (and index 0) from the cell renderer, and using that component's preferred size.

As I understand it, you've given each cell a fixed width that's shorter than the cells should be. By commenting out that line, as Rob C suggested, each cell gets its correct preferred width.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic