?
Solved

using canvas

Posted on 2003-03-11
6
Medium Priority
?
232 Views
Last Modified: 2010-03-31
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
Comment
Question by:namitthapa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 80 total points
ID: 8112565
Paint the images on two separate panels
0
 
LVL 2

Assisted Solution

by:glottis
glottis earned 80 total points
ID: 8114426
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
 

Expert Comment

by:CleanupPing
ID: 9058779
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!

 
LVL 2

Expert Comment

by:glottis
ID: 9067787
CEHJ and My answer does work... namitthapa never returned.
0
 
LVL 35

Expert Comment

by:girionis
ID: 9700625
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
 
LVL 1

Author Comment

by:namitthapa
ID: 10308348
thanx all for your great help
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses
Course of the Month8 days, 23 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question