This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes loading images in swings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "loading images in swings" Watch "loading images in swings" New topic
Author

loading images in swings

kalyan chowdary
Greenhorn

Joined: Jun 22, 2006
Posts: 24
Hi ,

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
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
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

You can put the panel in a JScrollPane, if desired.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: loading images in swings
 
Similar Threads
chat application like facebook
how to store images in mysql
Accessing image files of user entered paths
send arraylist to swings from servlet
JTree