0

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.

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

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
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.