I was building a view and then I realized that I needed to put too much information inside, so it would not fit in the window. So I decided to create a JScrollPane to put all the elements inside, and continue including new elements if needed, be able to see it all in my window.
This is the code for my scroll pane:
public JPanel getActionsPane() {
if (Objects.isNull(actionsPane)){
actionsPane = new JPanel();
actionsPane.setLayout(null);
actionsPane.setBounds(0, 29, 1580, 1450);
addComponents();
}
return actionsPane;
}
public JScrollPane getActionsScrollPane() {
if (Objects.isNull(actionsScrollPane)){
actionsScrollPane = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
actionsScrollPane.add(getActionsPane());
actionsScrollPane.setLayout(new ScrollPaneLayout());
actionsScrollPane.setBounds(0, 29, 593, 400);
actionsScrollPane.setViewportView(getActionsPane());
}
return actionsScrollPane;
}
But when I compile, I can only see this:
[![JScrollPane in runtime]](https://i.stack.imgur.com/RUm5k.png)
As you can see, the scroll is not being showed. I have not worked very much with JScrollPane in the past, maybe I am missing some propierty to enable the scrolls?
