My application has a lot of buttons on it, and in order to create a skin for my application, I've been just creating a lot of images in my working directory and loading them all into my application as ImageIcons. I like working with ImageIcons, but not working with a lot of images in my working directory, so does anyone know how to take one bitmap image and seperate it into multiple ImageIcons? ultimately what I'd like to do is push all my images together into one image and then just say the first ImageIcon is this portion of the file, and the second ImageIcon is this portion... etc.

I've looked all over the internet but haven't had much luck finding what I want. any help would be greatly appriciated.

Thanks :)

Recommended Answers

All 2 Replies

You can read your big file into a BufferedImage, then use its getSubimage method to pick out the separate icons, and pass those to the ImageIcon constructor

Thanks, that's exactly what I was looking for :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.