我是科学计算专业的学生,我有一个疑问..
是否可以有1个JScrollPane,里面有2个JTable? 而且,当我移动滚动条时,表格 1 和表格 2 一起移动?
最佳答案
Is it possible to have 1 JScrollPane with 2 JTable inside?
这不是个好主意,因为
JScrollPane
指定只嵌套一个JComponent
,任何尝试都会遇到自然滚动的问题和
JTable
在被指定了里面JScrollPane
And, when I move the scroll, the table 1 and table 2 move together?
- 是的,创建两个
JTable
既简单又可行。与JScrollPane
s,然后使用AdjustmentListener
添加到JScrollBar
(s),直接源自JScrollPane
, example for AdjustmentListener
关于java - 是否可以在JAVA中仅将2个jtable插入到一个jscrollpane中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32118782/