views:

20

answers:

1

Hi,

how (if at all) can I make multiple JScrollPanes have different views on 1 common component (a JTable in this case). Every time I set the viewport of a scrollpane, the previous scrollpane's view disappears...

Cheers, Max

+1  A: 

A Component can have only 1 parent. You can't put the same JTable in two JScrollPanes. You can, however, create two JTables backed by the same model, and put those two tables into their own scroll panes.

akf
Yes, that's my current solution, but it causes some problems which I try to eliminate by using the same table. I wasn't aware of that the JTable is actually added when used in a JScrollPane, but it seems to be added on a JViewPort...
Max