I believe too that is a problem of layout. A hack solution is to set the background color of thet area (infact of all the table) to match the background of your JFrame if any +/- setting off the borders of JScrollPane.

0

afterburnerAuthor Commented: 2002-04-24

EEs:

This problem was mentioned in a previous thread, but I thought it would disappear once the scrollbars, headers, scrollpane issues had been sorted, but it didnt. So ozymandias posted some code which was almost identical to mine, even used the same Borderlayout manager. His code worked ok, wihtout any blank space, although it was not based on the same table model. The difference between his code and mine was that mine was partially generated inside Forte IDE, whilst his was apparently not done in an IDE. When I tried his, I planted it straight into user code, in other words my IDE was not handling the generation of the jtable and scrollpane objects. But I cant see why the IDE would affect an issue like this, especially as it used the same layout man. Nor can I understand why he was seeing space below the table in the code I sent him, if he was not running it in an IDE.

Here is my code, which I sent to ozymandias before, and which he got the same space problem under the table:

It seems to me its not the size of the table that needs adjusting, its the size of the initial JFrame.

But when I try to set that size, I get what I asked for, but the scrollbars are not showing, and nor is a small textfield that sits at the bottom of the screen. These only appear when I drag a resize, or even just put the cursor over the frame border and click. I have tried event code which calls alls sorts of things, but it dont work.

Also, I don't see much difference between adding the scroll pane to the CENTER vs. the WEST -- the scrollbars appear normally, and the table works as expected.

The only real difference is that there's a small blank area on the right side of the table, since a WEST oriented component will not expand to fill in the entire horizontal space, even if there are no CENTER or EAST components...

This must be a peculiarity of the BorderLayout manager.

0

afterburnerAuthor Commented: 2002-04-24

nebeker

That is totally correct, not to mention cool.

Once I had wondered why my table wouldn't display, I cut it, then pasted it back, and somehow the IDE liked that, and at the next Run decided to display it.

In fact setting the preferred size of the scroller is not completely correct as it doesn't take some of the trimmings into account resulting in the window being a little small.
Setting the preferred size of the viewport as I suggested, makes the window exactly the right size.

0

afterburnerAuthor Commented: 2002-04-24

I'm not really qualified to answer your question (obviously), and the machinations which these super-IDEs get up to leaves me in the dark sometimes (again obvious from all this).

But I do know that although your code worked, it only did so after I moved either the scroller or the table to another compass point. If they both stayed CENTER then I could only see the scollpane. Why I thought of cutting the scrollpane then repasting it immediately into the window at centre again eludes me now, but it worked. The IDE is great but if it is going to play the role it does, then I would have thought it could be trusted to stack the components entrusted to it in the right order. But hey, whadda I know.