我正在尝试捕捉鼠标点击,即使在
Table
(这将导致弹出窗口显示)。桌子在一个
ScrollPane
它(依次)在
Panel
. 我已经为所有的类添加了反应,但我似乎从来没有真正得到一个点击事件被捕获!
class MyPanel extends GridBagPanel {
val gbc = new GridBagContraints( ... )
add(new ScrollPane {
reactions += {
case MouseClicked(src, point, mod, clicks, pops) =>
println("Scroll pops: " + pops)
}
viewportView = new Table {
reactions += {
case MouseClicked(src, point, mod, clicks, pops) =>
println("Table pops: " + pops)
}
...
}
}, gbc)
reactions += {
case MouseClicked(src, point, mod, clicks, pops) =>
println("Panel pops: " + pops)
}
}
无论我点击哪里,都不会打印任何内容。我做错什么了?