This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes SetVisibleRowCount ignored Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "SetVisibleRowCount ignored" Watch "SetVisibleRowCount ignored" New topic
Author

SetVisibleRowCount ignored

Marc Beck
Ranch Hand

Joined: Sep 09, 2006
Posts: 36
SetVisibleRowCount gets ignored. The list always displays all of its items, but I only want to display four at a time. This happens with all my lists. This piece of code is just one out of several cases.

Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
Originally posted by Marc Beck:
SetVisibleRowCount gets ignored. The list always displays all of its items, but I only want to display four at a time. This happens with all my lists. This piece of code is just one out of several cases.



So how do you actually display leaderlist on the screen?

Calling setVisibleRowCount() should affect the preferred size of the scroll pane, but many layout managers will ignore the preferred size. Other than that setVisibleRowCount() doesn't do a whole lot.

For grins you might want to call setLayoutOrientation(JList.VERTICAL_WRAP) just to see what effect it has.


bitguru blog
Marc Beck
Ranch Hand

Joined: Sep 09, 2006
Posts: 36
I am using box layout manager to display Leaderlist and all my other lists. I tried what you suggested, but it did not do anything.
 
jQuery in Action, 2nd edition
 
subject: SetVisibleRowCount ignored