Hey guys! I'm trying to make a GUI program. The program can take a picture from the computer, then the user can tag certain areas and input names. When the user hovers over the area where he/she tagged, it would show the name of the person tagged. And also, the the tagged names appear at the bottom of the picture.

I'm not asking anyone to make the whole program for me. I just wanna get an idea of how to do it. Right now, I don't have the slightest idea on how to accomplish this. I was thinking that midpoints or points on the JFrame is the key. But I'm still not quite sure.

I guess you're going to have a window in which the image is displayed. You'll need a MouseMotionListener to generate MouseEvents when the mouse is moved in the window, and you'll need some data (a tag) that links a person to a rectangular area (top left and bottom right coordinates) that you can check the mouse position against. So you'll have a MouseMotionListener that goes something like:

void mouseMoved(MouseEvent e) {
   get mouse x,y coords
   for each tag in this picture's data
      if mouse coords are inside the tag's rectangle 
         display the person's name from the tag
         return;
      clear name display
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.