[英]How to make JFrame or JPanel Scrollable
i have added multiple component on JPanel & then i add JPanel on JFrame. 我在JPanel上添加了多个组件,然后在JFrame上添加了JPanel。
how to make window scrollable ? 如何使窗口可滚动?
so i can add more component at that frame or window . 所以我可以在那个框架或窗口添加更多的组件。
Before adding your JPanel
, put in a JScrollPane
first: 在添加
JPanel
之前,首先输入JScrollPane
:
JPanel panel = ...;
JScrollPane scroll = new JScrollPane(panel);
frame.add(scroll, ...);
只需将您的JPanel放在JScrollPane中并将其添加到JFrame就可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.