Unable to display ScrollPane when added to a Panel
posted 13 years ago
Because the content pane uses BorderLayout and you are adding it to the center, the scrollpane takes up all available space. JPanel by default uses FlowLayout, which displays components as they are added according to their preferred size. An empty scrollpane has no preferred size, so it's there, it just has a size of 0, so you can't see it.