开发者

Multiple Images with JScrollPane in JPanel

开发者 https://www.devze.com 2022-12-21 23:32 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号