O
oliv
hi,
I am targetting JRE 1.5.
I have an image displayed within a jscrollPane (with scrollbars).
(in this way : new JScrollPane(new JLabel(new ImageIcon(image))))
I have a MouseMotionListener added to the JScrollPane, so when the
mouse goes over the visible part of the image, I can get the relative
coordinates of the mouse
My question is how to I get at the same time, the coordinate of the
mouse relative to the jscrollpane (the coordinates within the visible
part of the image) and the absolute coordinates (the coordinates of
the mouse relative to the whole image itself).
I tried adding also MouseMotionListener to the JLabel and that gives
me the the coordinates of the mouse relative to the whole image
itself, but then the event is lost for the jscrollpane's listener.
How can I achieve that simply ?
I am targetting JRE 1.5.
I have an image displayed within a jscrollPane (with scrollbars).
(in this way : new JScrollPane(new JLabel(new ImageIcon(image))))
I have a MouseMotionListener added to the JScrollPane, so when the
mouse goes over the visible part of the image, I can get the relative
coordinates of the mouse
My question is how to I get at the same time, the coordinate of the
mouse relative to the jscrollpane (the coordinates within the visible
part of the image) and the absolute coordinates (the coordinates of
the mouse relative to the whole image itself).
I tried adding also MouseMotionListener to the JLabel and that gives
me the the coordinates of the mouse relative to the whole image
itself, but then the event is lost for the jscrollpane's listener.
How can I achieve that simply ?