S
Sascha Konrad
Hello,
I have a JTextPane where I want to determine the position of the mouse.
So if there is a mouse moved event, I will do
int hoverPosition = jCurrentSentencePane.viewToModel(e.getPoint());
to determine the position (as the position of the letter) in the text
pane over which the mouse hovers. Now I have the problem that this
method returns bogus values if the mouse is somewhere in the text pane,
but not on the text. E.g., when I slowly approch the text somewhere
from the top, it tells me 0 as the hoverPosition, from the bottom it
tells me 35 (the length of my text). I was expecting to receive -1 or
so when I am not over the text, not the beginning or end of my text.
Does anybody have any suggestions?
Thanks.
I have a JTextPane where I want to determine the position of the mouse.
So if there is a mouse moved event, I will do
int hoverPosition = jCurrentSentencePane.viewToModel(e.getPoint());
to determine the position (as the position of the letter) in the text
pane over which the mouse hovers. Now I have the problem that this
method returns bogus values if the mouse is somewhere in the text pane,
but not on the text. E.g., when I slowly approch the text somewhere
from the top, it tells me 0 as the hoverPosition, from the bottom it
tells me 35 (the length of my text). I was expecting to receive -1 or
so when I am not over the text, not the beginning or end of my text.
Does anybody have any suggestions?
Thanks.