• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Scrolling in a JScrollPane problem

 
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have created a JList was built with a vector of
strings and then loaded into a JScrollPane. The scrollbars for the JScrollPane have both been set up as always. Some of the text in the JList is long and does not show in the list.
My problem is in the horizontal scrolling. The vertical scrollbar scrolls up and down, however, if the text is too long horizontally, I see several dots to the right but when I click the horizontal scrollbar nothing happens.
Any ideas??? I'm stuck.
barry
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let's see the code.
 
Barry Brashear
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
// listOne is the JList and
// scrollOne is the JScrollPane
// listItems is a Vector of strings
listOne = new JList( listItems );
listOne.setCellRenderer(new TextListRenderer
(pageItem));
listItems.elementAt( startIndex ), true);
listOne.setFixedCellWidth(380);
listOne.setSelectionMode ( (ListSelectionModel.SINGLE_SELECTION);
listOne.setFont( new Font( "serif", Font.BOLD, 18 ) );

scrollOne = new JScrollPane( listOne, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS );
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess your calling setFixedCellWidth(xx) method...which restricts the Label Width...try removing it.
 
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic