Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can i have the coordinate on a buffered image ?

 
motress zlting
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i have the coordinate on a buffered image ?
i have these two coding, one is buffered image and the other is coordinate part.
How can i combine the coordinate part with the buffer image coding ?
The imageBrowser is coordinate part, the imagecapture is buffer image part. Kindly take a look on it.




 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you describe in words what you mean by "the coordinate on a buffered image"? What are the inputs, and what are the outputs? The code you posted is very thinly commented, and doesn't make clear what the end result should be.
 
motress zlting
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Can you describe in words what you mean by "the coordinate on a buffered image"? What are the inputs, and what are the outputs? The code you posted is very thinly commented, and doesn't make clear what the end result should be.


In the imagebrowse file, when mouse move over the image, wherever the mouse move on that image, the system will print the current coordinate. But i want to make use of this function to the buffer image....
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What stops you from adding the same MouseMotionListener to the ImageCapture object?
 
motress zlting
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:What stops you from adding the same MouseMotionListener to the ImageCapture object?


i have try to add mouselistener into imagecapture , but cannot work .....sobs...
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but cannot work .....

Why not? How did you do it, and what happened?
 
motress zlting
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:
but cannot work .....

Why not? How did you do it, and what happened?


i have combine 2 file, but the label keeps printing the coordinate on that image when mouse moved.
I don't want the label to print coordinate on image, i just want to print it in console.....How can i do this ? Help me take a look.

 
motress zlting
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe i need to start with easier part.
I want to start with this simple part.
How can i click on an buffered image and print out the coordinate ?
 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't click on a BufferedImage, since a BufferedImage is only something in memory. You can catch a click on the component that is painting the image using a MouseListener, then translate the mouse location from relative to the component to relative to the image:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic