My goal is to create a clone of minesweeper. I've created a custon component that extends the JButton class, for each of the minesweeper buttons. I've called this new class SweeperButton. the game board is going to be made in another class by creating a two deminsional array of SweeperButtons, displaying them, and handling the logic for the game.
That having been said, there's somewhere between 12 and 15 images that I need to load into the program as ImageIcons, so that my SweeperButtons can use them as icons. although I'd like the array of images to be loaded into the SweeperButton class, I don't really want my program to load 15 images into every instance of the SweeperButton class that I create (what with there being at least 81 buttons that have to be created)
the solution I would prefer would be to create a static array of ImageIcons so that all the instances could access them, but only one copy of the array would exist, however I'm not quite sure how to do that.
any help would be appriciated... I'm sorry that there's no code... all of my images are saved in one file and I've been loading that file into a buffered image and using getSubImage() to break it up into multiple ImageIcons. I'd still like to be able to do this, but like I said it should only create one copy of the array.
Thanks :)