Search code examples
javaimageswingjpaneljscrollpane

JScrollPane - multiple Images on new line


I currently have a JScrollPane in a JPanel. I have Images that are loaded into the JPanel from a database so the amount of Images that load varies.

I have set the JFrame that the JScrollPane is found on to a size of 800 * 800. Atm the pictures from the database just load on one massive line across the screen and the JScrollPane helps to see these but I would like to make a new break after three Images.

What would the best way be to go about this?


Solution

  • Use GridLayout with 3 columns for the JPanel.