I want to set the images(minimun 15 ) in swings JPanel.
I want to load images which are coming from oracle database for each ImageIcon i have to create JLabel dynamically.
How it is and the last one is which layout is the best one.
Help me urgent
posted 9 years ago
The layout depends on what you are doing. To show a series of images you can often use GridLayout, specifying the number of rows or the number of columns as desired. GridBagLayout works well when you know how many columns you want; these can be controlled with the gridwidth field. Once you retrieve your images from the database you can make a loop to create a JLabel with ImageIcon containing the next image and add it to the parent panel. For a 5–column GridBagLayout you could try something like