File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Visuals...determining the right table column size, gui size ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "Visuals...determining the right table column size, gui size ?" Watch "Visuals...determining the right table column size, gui size ?" New topic
Author

Visuals...determining the right table column size, gui size ?

Karl Fu
Ranch Hand

Joined: Mar 26, 2001
Posts: 41
how do you determine the right column size for each row?
i tried to use the formula "fields.length * CONSTANT" for each column's width..but not every column's heading will have enough space to be displayed. If i increase the constant to give space to show all columns, then my gui will almost covered up my entired screen...and the carrier column will have too many space wasted.
Any suggestion ?
I also tried to format the column header into 2 rows if they are composite of 2 or more words....but the display remains unchanged. How do i accomplish that ?
Thanks in advance
Karl
Narayan Veeramani
Greenhorn

Joined: Jun 06, 2001
Posts: 25
For having multiple lines on the column header in the JTable,
you need to use the cell renderer object associated with the
table header of the JTable. You can get the renderer
as follows and then perform the column header rendering.
TableCellRenderer headerRenderer = table.getTableHeader().
getDefaultRenderer();
 
 
subject: Visuals...determining the right table column size, gui size ?
 
Threads others viewed
Selecting a row in a JTable using a RadioButton
Escape Character Help
About Thread and String. Help!
GridBagLayout
Remembering JTable column widths
developer file tools