aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes regarding JTable scrollabrs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "regarding JTable scrollabrs" Watch "regarding JTable scrollabrs" New topic
Author

regarding JTable scrollabrs

tadi raja
Ranch Hand

Joined: Jul 07, 2008
Posts: 109
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

Joined: Sep 20, 2005
Posts: 862
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 ]

bitguru blog
tadi raja
Ranch Hand

Joined: Jul 07, 2008
Posts: 109
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

Joined: Sep 20, 2005
Posts: 862
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

Joined: Jul 07, 2008
Posts: 109
my table have max of 10 rows ...
Ananya Mohan
Greenhorn

Joined: Dec 11, 2008
Posts: 7
Make the scrollbar policy as needed instead of showing always.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: regarding JTable scrollabrs
 
Similar Threads
no vertical lines in JTableHeader
JTable
JTable
JTable Display Problem
JTable in a JScrollPane : no scrollbars!