我禁用了以下代码显示水平ScrollBar:
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
它不再可见,但可以通过鼠标滚轮使用。我该如何防止这种情况?
有一个带有垂直ScrollBar的ScrollPane。但我可以点击鼠标滚轮到右边,内容滚动水平。
感谢。
答案 0 :(得分:27)
hash1 = {"key1" =>["value1","value11"], "key2" => ["value2","value21"]}
hash2= {"key3" => ["value3","value32"], "key4" => ["value4","value42"]}
hash1.each do |k1,v1|
hash2.each do |k2,v2|
#do something with v1 and v2 (which are arrays themselves and get ["value1","value11"] and ["value3","value32"], then ["value1","value11"] and ["value4","value42"] in the first iteration of hash 1 and ["value2","value21"]and ["value3","value32"], then ["value2","value21"]and ["value4","value42"] in the second iteration of hash1 )
end
end
答案 1 :(得分:1)
编辑:使用this answer代替这个hacky
您可以使用ScrollEvent
中的水平event filter:
scrollPane.addEventFilter(ScrollEvent.SCROLL,new EventHandler<ScrollEvent>() {
@Override
public void handle(ScrollEvent event) {
if (event.getDeltaX() != 0) {
event.consume();
}
}
});
答案 2 :(得分:0)
我相信这是正确的方法:
sp.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);