createImage issue

I’m new here (this is my first post) and a pretty big noob, just started programming and working with tutorials along with reading on Java, but I’m having an issue getting an image onto a button. I’m making a puzzle game that creates 12 cropped squares of an image that you can shuffle around to form the original picture.

Here’s the part I’m having problems with.

for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				if (j == 2 && i == 3) {
					label = new JLabel();
					centerPanel.add(label);
				} else {
					button = new JButton();
					button.addActionListener(this);
					centerPanel.add(button);
					image = new createImage(new FilteredImageSource(source.getSource(), 
                          new CropImageFilter(j * width / 3, i * height / 4, (width / 3) + 1, height / 4)));
					button.setIcon(new ImageIcon(image));
				}
			}
		}

the image = new createImage() part is telling me createImage() doesn’t exist. Am I forgetting to import anything or am I calling and/or passing the wrong stuff?

any help would be much appreciated.

Thanks!

createImage is method, not a class that can be instanced. It’s owned by Toolkit class.

I’m an idiot lol! thanks!

Are you not using eclipse? it should scream about this :slight_smile:

yeah, I am using Eclipse, but the flag it put up didn’t make sense to me. But it all makes sense now.

It will when you hover your pointer to it. For small thing it’ll fix it for you, but not in this case ;D

Thanks for the help! I’ll be back with more stupid errors I’m sure, haha.