LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-10-2011, 09:43 AM   #1
vitorsgoncalves
Member
 
Registered: Mar 2010
Posts: 96

Rep: Reputation: 18
Horizontal scrolling in a jTable


I am creating an application in java that uses a jTable for showing some data.
There are multiple columns in that table, an I do not want to show them all at once, so the user slides the horizontal scroll for viewing the remaining columns.

How can I do that?
 
Old 03-10-2011, 10:15 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,630
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
It should be enough to call

Code:
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
Certainly, this works with the SimpleTableDemo from Oracle (if it doesn't work with your code, perhaps you can post it so we can see why not)
Hope this helps
 
1 members found this post helpful.
Old 03-10-2011, 10:28 AM   #3
vitorsgoncalves
Member
 
Registered: Mar 2010
Posts: 96

Original Poster
Rep: Reputation: 18
It was so simple... I have searched in the web without success.

Thanks.
 
Old 03-10-2011, 03:39 PM   #4
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,630
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
No worries
 
  


Reply

Tags
horizontal, java, scroll, scrolling, table


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
synaptics touchpad - horizontal scrolling adityavpratap Slackware 5 10-05-2009 08:34 PM
Horizontal scrolling cdhgee Linux - Hardware 4 03-11-2008 09:52 AM
html unwanted horizontal scrolling rblampain Programming 2 12-28-2007 09:54 PM
Horizontal scrolling and other buttons on Microsoft Laser Mouse 6000 cdhgee Linux - Hardware 0 03-29-2006 09:54 PM
Logitech MX1000 horizontal scrolling now goes forward and back. shoota Linux - Hardware 1 12-06-2005 04:52 PM


All times are GMT -5. The time now is 05:24 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration