From owner-freebsd-java Tue Mar 3 01:32:01 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id BAA09303 for freebsd-java-outgoing; Tue, 3 Mar 1998 01:32:01 -0800 (PST) (envelope-from owner-freebsd-java@FreeBSD.ORG) Received: from one.one.com.au ([203.37.221.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id BAA09275 for ; Tue, 3 Mar 1998 01:31:55 -0800 (PST) (envelope-from raymond@one.com.au) Received: from one.com.au (pxx.one.com.au [203.18.85.33]) by one.one.com.au (8.8.6/8.7.6) with SMTP id TAA08294 for freebsd-java@FreeBSD.ORG; Tue, 3 Mar 1998 19:12:40 +1000 (EST) Date: Tue, 3 Mar 1998 19:12:40 +1000 (EST) From: Raymond D Newman Message-Id: <199803030912.TAA08294@one.one.com.au> Subject: Key events in JDK port to FreeBSD To: undisclosed-recipients:; Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org To: freebsd-java@FreeBSD.ORG The following is a problem sun failed to come to grips with - so I'm not supprised that the FreeBSD port is a little inconsistent. The java code below is designed to display key event codes. With the sun JDK 1.1.5 and 1.2beta, the keycodes for the numeric keypad change depending on the "numlock" status - this is junk considering "normal" keyboards don't have a numlock key. With the latest JDK port on FreeBSD 2.2.5 I get some interesting and confusing results using X with fvwm. When the keyboard is "standard", the numbers 1 to 9 on the numeric keypad don't register (ie. no interupt), all other KP keys work including both the minus and comma (which is different to sun). When I use xmodmap to tell X to use "Digital" style keys, PF1 -> PF4 and the comma keys stop working and the numbers (1 to 9) now give keycodes. In both cases the KPEnter and Return keys give the same code (10) and the Do, Help and some other function keys don't seem to work at all. Is there some way I can get a unique key code from every key on the keyboard no matter what X has been told? Ray Newman AKey.java --------- import java.awt.*; import java.awt.event.*; public class AKey extends Frame implements KeyListener //Create our class { public AKey() //Constructor { Panel centerPanel = new Panel(); //Use the center setLayout(new BorderLayout()); //standard layout mgr addKeyListener(this); //Add key listner } public void keyPressed(KeyEvent e) //Catch key presses { int keyCode = e.getKeyCode(); //Get the key pressed int modifiers = e.getModifiers(); //and the modifiers System.err.println("Press="+keyCode+" Mod="+modifiers); } public void keyReleased(KeyEvent e) { int keyCode = e.getKeyCode(); //Get the key int modifiers = e.getModifiers(); //and the modifiers System.err.println("Release="+keyCode+" Mod="+modifiers); } public void keyTyped(KeyEvent e) { } public static void main(String args[]) { AKey window = new AKey(); window.pack(); window.show(); } } //end class AKey To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message