This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Problem in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem in JTable" Watch "Problem in JTable" New topic
Author

Problem in JTable

Vishal Methi
Ranch Hand

Joined: Jan 14, 2004
Posts: 52
Is it possible in JTable to change the size of a particular row. Actually i have with 10 rows and 10 columns and i want the size of 4th and 8th smaller than other rows......... plz suggest me asap...........
Thanx
Vishal
Jason Steele
Ranch Hand

Joined: Apr 25, 2003
Posts: 100
you would have to extend JLabel and implement DefaultTableModel
or extend AbstractTableModel. Preferrable the second option.

Then in the getTableCellRendererComponent method, test to see if you are in row 4 or 8...or better yet row % 4 == 0. If it is, then call setPreferredSize on that label to be the size you desire.


Good Luck!


An egg is a chicken's house!
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
JTable.setRowHeight(row, rowHeight) is another possibility.


SCJP2. Please Indent your code using UBB Code
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in JTable
 
Similar Threads
JTable
Height of JTable
JTable
regarding JTable scrollabrs
jtable