How to add scrollbar to panel?

依然范特西╮ 提交于 2019-12-02 15:20:30

问题


I need help. I have one panel which can need to have width 1000px. I need to add lot of buttons with different size ( I add with flow layout and it works fine). Problem is that I have height on screen example 500px but when I add buttons panel has bigger size. How to add scrollbar to panel ?


回答1:


Add your panel to scrollpane and add that pane where you are adding your panel instead of panel

JScrollPane jScrollPane = new JScrollPane(panel);


来源:https://stackoverflow.com/questions/5790525/how-to-add-scrollbar-to-panel

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