Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

using canvas

I want to draw an image when a user Click on a button.When a user click on another button,  another image should be drawn.But the previously drawn image also should reamin in the canvas area.
0
namitthapa
Asked:
namitthapa
2 Solutions
 
CEHJCommented:
Paint the images on two separate panels
0
 
glottisCommented:
what you may do is keep a note of all the images drawn on the canvas.
keep a vector of images. in the paint method of the canvas iterate through the vector and draw all the images.
for eg.

vector images = new vector();
on button1.click images.add(Image1);
on button2.click images.add(Image2);

onPaint(Graphics g) {
  int total = images.size();
  for (int i=0; i<total; i++)
    draw((Image)images.elementAt(i))
}
0
 
CleanupPingCommented:
namitthapa:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
glottisCommented:
CEHJ and My answer does work... namitthapa never returned.
0
 
girionisCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- To be PAQed and points NOT refunded.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer
0
 
namitthapaAuthor Commented:
thanx all for your great help
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now