Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding JTable scrollabrs

 
tadi raja
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a small doubt in JTable,i want to display 10 number of rows, each row contains data(i can retrieve data from web services and displayed in Table cell)in that time i don't need scrollbars for that particular table, because of i am trying to print that table vertical scrollbars are coming in the printed page and aslo inside the vertical scrollbars the data is not showed in printed page..is there any possibility to fix perfect size without using scrollbars for that talbe.thank you in advance.
 
Brian Cole
Author
Ranch Hand
Posts: 906
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by tadi raja:
i have a small doubt in JTable,i want to display 10 number of rows, each row contains data(i can retrieve data from web services and displayed in Table cell)in that time i don't need scrollbars for that particular table, because of i am trying to print that table vertical scrollbars are coming in the printed page and aslo inside the vertical scrollbars the data is not showed in printed page..is there any possibility to fix perfect size without using scrollbars for that talbe.thank you in advance.


I'm not sure exactly what you are asking (for example: Do you know the pixel size you want and are asking how to set it, or are you asking how to figure out how many pixels you need?) but I feel I should point out that it's always safe to put the JTable in a JScrollPane. If it fits, then the scroll bars won't even appear* and the user will be none the wiser. Also, the table's header won't automatically appear if you don't use a JScrollPane.

*This is actually up to the look and feel, I believe, but most LnFs behave this way.

[edit: footnote added]
[ December 09, 2008: Message edited by: Brian Cole ]
 
tadi raja
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brian Cole ,
i am using JScrollPane to fit the JTable,still i got vertical scrollbar.can you please help me.
 
Brian Cole
Author
Ranch Hand
Posts: 906
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by tadi raja:
i am using JScrollPane to fit the JTable,still i got vertical scrollbar.can you please help me.


Which look and feel are you using?

I get no scroll bars with this code under Windows LnF or Metal.



If I reduce the size of the frame to be smaller than the height of the six rows, then a vertical scroll bar appears. How many rows does your table have?
 
tadi raja
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my table have max of 10 rows ...
 
Ananya Mohan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make the scrollbar policy as needed instead of showing always.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic