如果我把JScrollPane滚动条放在左边,视口的左边部分就放在滚动条下面。
jScrollPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);如何将视区与滚动条的右侧对齐?
发布于 2018-02-22 19:45:50
在这里找到了答案:多亏了拉夫克,http://forums.codeguru.com/。它工作得很好。
jScrollPane.setLayout(new ScrollPaneLayout() {
@Override
public void layoutContainer(Container parent) {
JScrollPane scrollPane = (JScrollPane) parent;
scrollPane.setComponentOrientation(
ComponentOrientation.RIGHT_TO_LEFT);
super.layoutContainer(parent);
scrollPane.setComponentOrientation(
ComponentOrientation.LEFT_TO_RIGHT);
}
});https://stackoverflow.com/questions/48926542
复制相似问题