Swing JSplitPane problem

旧巷老猫 提交于 2019-12-11 00:22:31

问题


How to Split Component vertically into different parts? Is It possible in Swing? I want to assign different ScrollBar to each part ?


回答1:


you should use the JSplitPane

if you need each part to be on a diffrent scroller - just put them on to diffrent scroller pane.

JPanel topPanel = new JPanel();
            JScrollPane topScrollPane = new JScrollPane(topPanel);

            JPanel buttomPanel = new JPanel();
            JScrollPane buttomScrollPane = new JScrollPane(buttomPanel);

            JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topScrollPane, buttomScrollPane);



回答2:


Try using JSplitPane. Then put a JScrollPane into each side.

If you want more than one split, you'd have to nest the split panes. Or use a multi-splitpane like this: MultiSplitPane



来源:https://stackoverflow.com/questions/7159817/swing-jsplitpane-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!