CaretEvent: how to obtain the typed - special - key ?


While handling
public void caretPositionChanged ( CaretEvent i_caretEvent )
, I need to find out the keys, and special keys the user pressed.

I checked all around the CaretEvent, the Editor, and even under the carpet, but could find nothing.
I'm sure it's obvious, but I'm shortsightened, and not a Swing expert, obviously.

Alain

3 comments

While handling
public void caretPositionChanged ( CaretEvent i_caretEvent )
, I need to find out the keys, and special keys the user pressed.


Of course this is not possible. Caret can change its position by lot of
reasons. For example, one can change its position in any place
programatically.

--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"


"Alain Ravet" < alainravet-jetbrains@yahoo.com> wrote in message
news:13260228.1070443068555.JavaMail.javamailuser@localhost...
>

While handling
public void caretPositionChanged ( CaretEvent i_caretEvent )
, I need to find out the keys, and special keys the user pressed.

>

I checked all around the CaretEvent, the Editor, and even under the

carpet, but could find nothing.

I'm sure it's obvious, but I'm shortsightened, and not a Swing expert,

obviously.
>

Alain



0

Valentin Kipiatkov (JetBrains) wrote:

>>While handling
>> public void caretPositionChanged ( CaretEvent i_caretEvent )
>>, I need to find out the keys, and special keys the user pressed.
>>
>>
>
>Of course this is not possible. Caret can change its position by lot of
>reasons. For example, one can change its position in any place
>programatically.

>

That why I suggested, somewhere in this thread, to return null for such
changes, as well as for mouse-click triggered caret changes.


I guess I should create my own listener, based on the CaretListener and
some other KeyListener, but I'm not sure how to handle the
unknown/unspecified/undocumented timing and call order of those 2.


Alain

0

I'm writing my own editor plugin for property files and need to know when IDEA
saves all changes (the clicked on 'Save All' or selected another window) to save my own changes.

Can someone help me?

Thanks, Stefan.

Alain Ravet wrote:

While handling
public void caretPositionChanged ( CaretEvent i_caretEvent )
, I need to find out the keys, and special keys the user pressed.

I checked all around the CaretEvent, the Editor, and even under the carpet, but could find nothing.
I'm sure it's obvious, but I'm shortsightened, and not a Swing expert, obviously.

Alain


0

Please sign in to leave a comment.