• 0

[JAVA] JList Horizontal scroll


Question

How do you set up a JList to have a horizontal scroll bar as needed? I've got one set up but its not working right. I was wondering if anyone could give me a sippet of code. I've got:

JList panel1 = new JList(all);

// all is a String array

panel1.setVisibleRowCount(17);
panel1.setFixedCellWidth(570);
panel1.addListSelectionListener(new panel1Listener());
JScrollPane scrolledtab1 = new JScrollPane(panel1);
scrolledtab1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
scrolledtab1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
panel1.add(scrolledtab1);

Link to comment
https://www.neowin.net/forum/topic/394696-java-jlist-horizontal-scroll/
Share on other sites

3 answers to this question

Recommended Posts

  • 0
  kjordan2001 said:
Should just be JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED

586776450[/snapback]

Yea, I had that there and it still didn't work. Even though the window needs a scroll bar it doesn't put it there. and even when its on always, it shows the scroll track, but not the scroll bar so you still can't do anything.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.