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?

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.

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.