Forums Register Login

Horizontal Scroll Bar

+Pie Number of slices to send: Send
I have a JScrollPane that I can't seem to slap a horizontal scroll bar onto.
Here's my code for my JScrollPane...

This scroll pane is sitting in a JPanel that has a layout of BorderLayout. Does that make a difference? When the table is populated with data, is sizes all of the columns so they fit within the panel. When the user expands one of the columns, I want them to be able to scroll horizontally. What am I doing wrong?
Thanks for any help!
+Pie Number of slices to send: Send
Try this on your table:
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+Pie Number of slices to send: Send
That worked, however, now my columns are all scrunched together. How can I still have my scrollbar appear, but have the columns as wide as the column headings. Or, how can I specify what the column width is supposed to be for a particular column?
Thanks again!
+Pie Number of slices to send: Send
I don't know for the scrollbar, but for the column's wide, you can proceed like this. I don't know if it is the best way.

I hope it's helping you
+Pie Number of slices to send: Send
Younes,
That worked! Now I have my horizontal scroll bar, and my columns aren't scrunched together!
Thanks for all of your help!
Have a GREAT day!!!
+Pie Number of slices to send: Send
Thx for the reply.
Nice to see it works
If you are using a rototiller, you are doing it wrong. Even on this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2835 times.
Similar Threads
need help to set horizontal bar to JList
JTable and Horizontal Scroll Bar
jscroll pane problem.
nx:All of URLy Bird 1.1.3 about JTable
How to gray out one particular row in JTable
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 04:25:39.