Reputation: 77
As one component of a project I have a table with a list of variables from the current class in scope of the eclipse text editor. I want to be able to double click a position in this table and have the contents printed to the screen for me using a JavaRobot. Everything is set but of course when I click the table, the text editor caret position disappears as the foreground job is the table. Is there a way to find out the caret position so then I know where it was and thus print the contents into the desired location?
I have seen it done with textPanes:
int currentCaretPosition = textPane.getCaretPosition();
On the left is an example table when I click it the cursor/caret position disappears.
Need to get the cursor position and save it so I can print to this location using JavaRobot when a user double clicks a column/row.
Thanks
Upvotes: 0
Views: 712
Reputation: 77
Thanks guys, using SWT is what I needed :)
Here is the code for future reference:
CurrentDisplay display = new CurrentDisplay();
Display previousDisplay =display.getDisplay();
Point caretPoisition = previousDisplay.getCursorLocation();
Upvotes: 0