Please Help! What causes JTable to shrink w/in JScrollPane?

I've looked everywhere for the answer for this, and lots of people have the same problem, but it never seems to get answered.
I have a JTable (3 columns) in a JScrollPane.
printerTable.setModel(data, colNames)
scrollPane = new JScrollPane(printerTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); Initially, the columns fill the entire width of the scrollpane. But when I refresh the data, the columns shrink and a white space is left on the far right side. What do I need to do to get the columns to always span the width of the scrollpane? Do I have to fire events?
I've tried all sorts of things, including...
printerTable.setPreferredScrollableViewportSize(printerTable.getPreferredSize());
printerTable.sizeColumnsToFit(-1)and I've tried setting preferred, min and max widths. Is there some order you have to put them in?
This is soooo frustrating...I've spent days trying to get this right and I haven't accomplished anything.

Thanks for trying to help guys! Actually I think I've finally gotten it to work! What a relief!
I figured I post it, since I've seen lots of posts from people having the same problem...
I created my own class that extended JTable and overrode the getScrollableTracksViewportWidth() to return true (I was only going to have 3 columns, not any more).
The other things that I had to do were:
queueTable.setAutoCreateColumnsFromModel(false);
queueTable.setPreferredScrollableViewportSize(new Dimension(200, 150)); //w x h
queueTable.setAutoResizeMode(MyJTable.AUTO_RESIZE_OFF);Plus, I removed the following that I had put in previously:
//queueTable.setPreferredSize(new Dimension(290,900));
//queueTable.setPreferredScrollableViewportSize(queueTable.getPreferredSize());I also didn't need to set the min, max, & preferred column widths or the preferred size of the table.

Similar Messages

Maybe you are looking for

  • A problem with the Bembo font in Pages

    I've designed a document using the Bembo font and it keeps substituting "Expert" for "Regular." I've actually removed "Expert" from my font book and yet I'm still having this problem. Any suggestions for how to fix this glitch?

  • Safari on my iPad won't display this URL

    http://radar.weather.gov/radar.php?rid=LWX&product=NCR&overlay=11111111&loop=yes Any clues?

  • Site Not Working On Firefox?

    Hello. This might be more of an issue with Tumblr itself, as opposed to Firefox, but I figured it would be worth posting here as well, since this is an issue that seems to be happening only on Firefox. I have contacted Tumblr regarding this issue, so

  • Can't open file Photoshop cc

    HI, after I have opened a file or two, when I attempt to open a third I get a "cannot complete request due to a program error" And can't open anything else until I quit the program and open it again.  I've tried re-installing the software, but to no

  • Adobe 9.0 Pro deleting signature field

    How do you delete a signature field in adobe 9.0 pro or standard? I can clear the signature, but not delete it entirely. I need to show engineers how to do this in case they create it the wrong size or in the wrong place. In adobe 7.0 pro and standar