Alt Key won′t work in Java under X

Alt Key won′t work in Java under X

Post by Andreas Kutscher » Wed, 21 Jul 1999 04:00:00



Hi there,
I have a problem with Java and my X-Server, but I dont know where the problem
lies.
Ive written a small Java program that includes the following lines:
--
JMenuItem newMask = new JMenuItem();
    newMask.setAccelerator(
      KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_N,
      java.awt.InputEvent.ALT_MASK ));
--
Now the event _only_ gets fired when I hit the "N" key, but not, when I hit
Alt-N (It works, if I try to CTRL_MASK and Ctrl-I).
Also, Alt-N _IS_ recognized when the program runs under Windows (which bugs me
a lot), but not when I use Linux.

I played around with my XF86Config (yes, I use XFree86), turned off the
XKEYBOARD extension (uncommented XkbDisable), and, voila, Alt-N works under
Linux.
However, as soon as I do that, my keyboard is screwed up, and I cannot type

when you try to write emails :-)
I played around with xmodmap and xev but I couldnt find anything.

Some people suggested I buy a different X server. Its supposed to work
under some others, but I cannot do that.

I could not find infos on the XKeyboard extensions anywhere.

Alt-Key in Java-Applications)?

Where should I look?
--
Andreas Kutschera, Siemens Business Services DS,     Tel. 030/386-28089
Nonnendammallee 101, D-13629 Berlin                  Fax  030/386-28106

 
 
 

Alt Key won′t work in Java under X

Post by hthom.. » Wed, 21 Jul 1999 04:00:00




> Hi there,
> I have a problem with Java and my X-Server, but I dont know where the
> problem
> lies.
> Ive written a small Java program that includes the following lines:
> --
> JMenuItem newMask = new JMenuItem();
>     newMask.setAccelerator(
>       KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_N,
>       java.awt.InputEvent.ALT_MASK ));
> --
> Now the event _only_ gets fired when I hit the "N" key, but not, when
> I hit
> Alt-N (It works, if I try to CTRL_MASK and Ctrl-I).
> Also, Alt-N _IS_ recognized when the program runs under Windows (which
bugs me
> a lot), but not when I use Linux.
> Where should I look?

This doesnt sound like a problem with linux itself!
Do you run a X Server under Windows for connecting to a linux server?
Then try to check the X Server of Windows for keymapping settings.

Mb try to code the mask like that:  Event.Alt_MASK,
not InputEvent.Alt_MASK.
And remember that java is sometimes casesensitive.

Regards,
Holger

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

 
 
 

Alt Key won′t work in Java under X

Post by Juergen Kreilede » Wed, 21 Jul 1999 04:00:00


Quote:>>>>> Andreas Kutschera writes:

    Andreas> I have a problem with Java and my X-Server, but I dont
    Andreas> know where the problem lies.  Ive written a small Java
    Andreas> program that includes the following lines:

    Andreas> JMenuItem newMask = new JMenuItem();
    Andreas>     newMask.setAccelerator(
    Andreas>       KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_N,
    Andreas>       java.awt.InputEvent.ALT_MASK ));

    Andreas> Now the event _only_ gets fired when I hit the "N" key,
    Andreas> but not, when I hit Alt-N (It works, if I try to
    Andreas> CTRL_MASK and Ctrl-I).  Also, Alt-N _IS_ recognized when
    Andreas> the program runs under Windows (which bugs me a lot), but
    Andreas> not when I use Linux.

It should work with 1.1.7v3 and 1.2pre2, older version may fail with
some X configurations.  If it doesn't work with 1.1.7v3 or 1.2pre2,
please let me known.

        Juergen

--
Juergen Kreileder, Blackdown Java-Linux Porting Team
http://www.blackdown.org/java-linux.html

 
 
 

1. Netscape and ALT+Left,ALT+Right keys

        I am using Netscape 1.0 with XFree86 3.1 on Linux 1.1.59. For some
reason the ALT+Left and ALT+Right keys do nothing instead of executing the
Back and Forward functions. Anyone have any ideas how to fix this ?

Cheers,
Neil

--
Neil Lovely                             |

South East Queensland Electricity Board | Phone  : +61 7 223 4256
GPO Box 1461  Brisbane Q 4001 Australia | Fax    : +61 7 221 7556

2. fixing video when you cat a binary :-(

3. <alt gr> key as <alt>?

4. Ink printers

5. <Alt>+<key> = <Esc><key> ?

6. nforce2 sound in Linux

7. Alt-Gr keys don't work with XDM/KDM

8. Mactels and linux?

9. My alt keys don't work in tgdb

10. Function of Keys ALT-CTRL key combinations

11. Alt Key, Meta Key on Solaris 5.7 X terminal?

12. Alt key no longer working in xterm / aixterm / dtterm

13. Alt key not working in Emacs in Mandrake 8.0