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 :)

5 Years
Discussion Span
Last Post by deshazer.jad

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.