File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes need help to set horizontal bar to JList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "need help to set horizontal bar to JList" Watch "need help to set horizontal bar to JList" New topic
Author

need help to set horizontal bar to JList

Vaishali Paramane
Ranch Hand

Joined: Mar 05, 2007
Posts: 106
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


SCJP, SCJD
Preparing for SCWCD
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

Can you please post an SSCCE?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Vaishali Paramane
Ranch Hand

Joined: Mar 05, 2007
Posts: 106
Please help me
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

Not without an SSCCE.
Vaishali Paramane
Ranch Hand

Joined: Mar 05, 2007
Posts: 106
Do you want me to post whole code?


Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2215
    
    7
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help to set horizontal bar to JList