0

Hey guys! I created a program that allows a user to display an image from a file chooser. I am trying to add a feature similar to that of the Facebook picture tagging system. When the user clicks on the image, a box with a dialogue box (where you input the name you want to tag) pops-up. How do I accomplish this? I was thinking of MouseClicked Events?

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by StephNicolaou
0

Yes, I would say so. With the mouse listener (mouse Clicked event) you could get the x,y co-ordinate for when you display the name of the person when the mouse rolls over the image (mouse entered). You could also draw a rect graphic in the paint method (that facebook has when you enter the photo) and display it over the tagged area using the x,y position.

The mouse listener tutorial can be found here, it's simple:
http://docs.oracle.com/javase/tutorial/uiswing/events/mouselistener.html

Just display a message box on click (mouse clicked event) to get the details (JOptionPane.showInputDialog(), tutorial is also found here:

http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html

Hope that helps.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.