So, I have a JPanel, panelWButtons, which contains a list of buttons. panelWButtons has a size of (350, 130). I was wondering how would I add a vertical scrollbar to the right side of the JPanel? So that if the buttons are exceeding the length of the panel, a scrollbar will appear Much help would be appreciated. Here is a snippet of my code:
final JPanel panelWButtons = new JPanel();
panelWButtons.setPreferredSize(new Dimension(350, 130));
JScrollPane scroller = new JScrollPane(panelWButtons); //is this right?
add(scroller, BorderLayout.CENTER);