This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I have a JTable with many columns, so many that the column headers are too small. I'm trying to figure out how to set a minimum size for the headers and have the user scroll horizontally to see all the fields. I have the table in a JScrollPane, wrote some code to set minimum column size, but it doesn't seem to work - vertical scroll bar shows up when it should, but not the horizontal scroll bar, so column headers are still small. I've looked around, but couldn't find code to scroll the table horizontally. Any ideas? Thanks in advance, Michael
I've always had to set minimum, maximum and preferred size to convince Swing not to squeeze everything in, even in a scrollPane. Does that work for you? If you figure out which ones you really have to set, let me know! But setting minimum doesn't seem to do it. HTH e
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>"Those who cast the votes decide nothing. Those who count the<BR>votes decide<BR>everything." <BR> -Joseph Stalin<HR></BLOCKQUOTE>
Joined: Oct 13, 2000
This seems to work OK: table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); All headers are the same size. It's a little wierd because the colums don't expand to fill the entire scroll pane area if there are just a couple columns, but for tables with many columns, a horizontal scroll bar shows up. I'm going to play around and see if I can't write some code that sizes individual colums to be just big enough to fit the column name. Thanks for the info, Michael