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 ?
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