Swing JSplitPane问题 [英] Swing JSplitPane problem

查看:91
本文介绍了Swing JSplitPane问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将组件垂直拆分为不同的部分?可以在Swing中进行吗? 我想为每个部分分配不同的ScrollBar吗?

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

推荐答案

,您应该使用如果您需要将每个零件放在不同的滚动条上-只需将它们放在不同的滚动条窗格中即可.

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);

这篇关于Swing JSplitPane问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆