Reputation: 15
i'm a student of science computing and I have a doubt ..
Is it possible to have 1 JScrollPane with 2 JTable inside? And, when I move the scroll, the table 1 and table 2 move together?
Upvotes: 1
Views: 485
Reputation: 109813
Is it possible to have 1 JScrollPane with 2 JTable inside?
not good idea, because JScrollPane
is designated to nest only one JComponent
, any attempts have got issue with natural scrolling
and JTable
in is designated has inside the JScrollPane
And, when I move the scroll, the table 1 and table 2 move together?
JTable
s with JScrollPane
s, then to use AdjustmentListener
added to JScrollBar
(s), derived directly from both JScrollPane
, example for AdjustmentListenerUpvotes: 2
Reputation: 3399
Add both JTable instances to a JPanel with BorderLayout, using NORTH and SOUTH constraints, and then add the JPanel to JScrollPane.
Upvotes: 0