This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Applets and the fly likes display image in mouse position Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "display image in mouse position" Watch "display image in mouse position" New topic
Author

display image in mouse position

Nirmal JeyaChandra
Greenhorn

Joined: Aug 31, 2005
Posts: 25
How can I display a image where ever I click the mouse on the screen. pls help.

If I give drawImage inside for loop and give the mouse cordinate to drawimage method it shows the image only once.

Please suggest me to get multiple time.
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Originally posted by Nirmal JeyaChandra:
How can I display a image where ever I click the mouse on the screen. pls help.

If I give drawImage inside for loop and give the mouse cordinate to drawimage method it shows the image only once.

Please suggest me to get multiple time.


One way to do it would be to maintain an ArrayList of Point objects that gets added to each time you click the mouse. Then in the paint method, you could simply iterate through the ArrayList and draw the image at each point.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: display image in mouse position
 
Similar Threads
Graphics problem , how to approach ?
How to select an image from many images in a JSP page?
image uploading and selection an image from many images?
How do I display JPEG, crop it, display cropped JPEG and undo crop.
How to manipulate the image