I have my code set up so I can 1)select what image and 2)the coordinates of the mouse click where the image is going to be placed.

What it currently does it place the right image in the right coordiantes but if I click again somewhere else, it replaces the last image's coords with the new clicked coords.

What I need is that when I click on the canvas, it should place the image permanently and when I click again it places an entirely new image.

Inside the mouse click event

//set new tower coords
if (minY>200){
	int towerID=towers.getTowerId(towerx, towery)
	towerx=minX;
	towery=minY;
	towers.setNewTower(towerType, towerx, towery);
	if (towerType==1)towerImage[towerID]=tower1;
	if (towerType==2)towerImage[towerID]=tower2;
	if (towerType==3)towerImage[towerID]=tower3;
	setnewtower=true;
	repaint();
}

Inside the paint method

if (setnewtower==true){
	int towerID=towers.getTowerId(towerx, towery)
	g.drawImage(towerImage[towerID], towerx, towery, observe);
}

TL;DR
How to create a new .drawImage while running the program?

Ah, I see what you're saying. I've been doing some internet searching. So, Canvas->panel and just change the name of the paint method to paintComponent? Is that all?

http://www.java2s.com/Code/Java/Swing-JFC/Rendersacomponentintoanimage.htm
I found this, and wondering if you think it's necessary I do this. It just seems like extra code but if it will decrease the bugginess...

Be a part of the DaniWeb community

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