Multiple Images with JScrollPane in JPanel
Ok, I am trying to add one row of multiple images to a JPanel, it can range from 15 - 30 images so I need to have a horizontal Scroll 开发者_JS百科Pane in the JPanel.
Now comes the hard part, how can I make it so the images can be removed then a new amount of images can be in its place?
You can either:
a) remove the images individually from the panel using the remove()
method and then revalidate()
the panel
Or
b) create a new panel with the new images and then add the panel to the scrollpane using the setViewportView(...)
method.
精彩评论