jEdit Community - Resources for users of the jEdit Text Editor
Java Swing Keyboard Events
Submitted by adraken on Sunday, 14 March, 2004 - 03:35
I'm in the middle of developing a plugin to provide EditPane switching like the Alt-Tab behavior on Windows and Macs. The idea is that although jEdit allows you to switch to the *next* EditPane, what you really want to do is switch to the last active EditPanes.

Windows lets you hold down Alt and hit Tab repeatedly to cycle through all the windows (in a circular linked list). When you find the one you want, you let go Alt. The newly-active window gets removed from the linked list and gets placed on the head. That means that you're able to switch very quickly between recently used windows with relatively little effort.

I've been trying to emulate this behavior, and since this kind of keyboard manipulation goes beyond the simple keyboard shortcuts, I've been trying to handle these events through the KeyListener interface, using the View.setKeyEventInterceptor() function to grab events. However, I'm noticing that I'm never receiving KEY_PRESSED events, only KEY_RELEASED and KEY_TYPED events. And even when I receive the KEY_RELEASED events, I'm never getting the KEY_RELEASED events for modifier keys like Ctrl or Alt.

Does anyone know if there's anything that jEdit does to keyboard events that might make this act weird? Or is this pretty standard behavior in Swing apps?
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
The KeyEventInterceptor mecha
by fireparser on Tue, 13/04/2004 - 14:52
The KeyEventInterceptor mechanism does by far not pass all key events to the registered KeyListener. There is in fact a lot of filtering done in processKeyEvent (in class View).

Maybe you could register directly by means of addKeyListener (of Component). This would probably be a hack but if you just scan for Ctrl+Tab it should work. At least you're guaranteed to receive all events Eye-wink.

Hope this helps.
Regards,
Christian.
good idea
by pinchy on Tue, 16/03/2004 - 13:59
This post could be of use:
http://community.jedit.org/?q=node/view/1144

Good luck with this; I'd most certainly use it.
User login
Browse archives
« April 2024  
MoTuWeThFrSaSu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82348
Context Free Art (*.cfdg)   0.31   46055
JBuilder scheme   .001   18495
BBEdit scheme   1.0   18116
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293