JDK-4496741 : KeyListeners wont get Alt+LeftArrow events when using special Logitech mouses
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2001-08-27
  • Updated: 2005-01-21
  • Resolved: 2005-01-21
Related Reports
Duplicate :  
Description
###@###.### 2001-08-27
--------------------------------
I can not allocate this special Logitech mouse to reproduce the
problem, so just log the bug with all the information.


J2SE Version (please include all output from java -version flag):
 java version "1.4.0-beta_refresh"
 Java(TM) 2 Runtime Environment, Standard Edition (build1.4.0-beta_refresh-b72)
 Java HotSpot(TM) Client VM (build 1.4.0-beta_refresh-b72, mixed mode)


Does this problem occur on J2SE 1.3?  Yes / No (pick one)
 Yes


Operating System Configuration Information (be specific):
 Win2K SP2


Hardware Configuration Information (be specific):
 Netfinity 5000, Dual PIII 550, 1GB RAM


Bug Description:
Using a Logitech mouse with the extra button for the thumb, as well as
the wheel button. Set them to be "Internet Back Command". This is
essentially the keystroke Alt + LeftArrow.  If use Spy in Windows, you can
see the key events being generated *almost* like pushing Alt+LeftArrow
normally.  But if open up a Java app and put KeyListeners in every conceivable
place, you don't get these events. If set the mouse to be anything that does
NOT involve use of the Alt key it works fine.  What actually happens is the
Frame menu gets activated (the one on the icon decoration in the top-left
corner, just like if you hit only Alt in a Java app on Windows).

Steps to Reproduce (be specific):
Use a mouse that has an extra button on Windows and set it to be the
"Internet Back Command". Use a KeyListener in a simple Java app(MouseTest.java)
to print out the key events. You won't get any for that action (and of course 
no mouse events either). However, using Spy you can see the key events being
generated and the functionality working correctly in Win32 apps that use the
Alt+LeftArrow command.

Test program:
public class MouseTest
{
	public static void main(String[] args)
	{
		java.awt.Frame f = new java.awt.Frame("MouseTest");
		java.awt.Canvas c = new java.awt.Canvas();
		f.setLayout(null);
		f.add(c);
		c.setBounds(0, 0, 100, 100);
		f.setSize(100, 100);
		c.addKeyListener(new java.awt.event.KeyListener()
		{
			public void keyPressed(java.awt.event.KeyEvent evt)
			{
				System.out.println("evt=" + evt);
			}
			public void keyTyped(java.awt.event.KeyEvent evt)
			{
				System.out.println("evt=" + evt);
			}
			public void keyReleased(java.awt.event.KeyEvent evt)
			{
				System.out.println("evt=" + evt);
			}
		});
		f.addKeyListener(new java.awt.event.KeyListener()
		{
			public void keyPressed(java.awt.event.KeyEvent evt)
			{
				System.out.println("evt=" + evt);
			}
			public void keyTyped(java.awt.event.KeyEvent evt)
			{
				System.out.println("evt=" + evt);
			}
			public void keyReleased(java.awt.event.KeyEvent evt)
			{
				System.out.println("evt=" + evt);
			}
		});
		c.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mousePressed(java.awt.event.MouseEvent evt)
			{
				System.out.println("evt=" + evt);
			}
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				System.out.println("evt=" + evt);
			}
			public void mouseReleased(java.awt.event.MouseEvent evt)
			{
				System.out.println("evt=" + evt);
			}
		});
		f.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mousePressed(java.awt.event.MouseEvent evt)
			{
				System.out.println("evt=" + evt);
			}
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				System.out.println("evt=" + evt);
			}
			public void mouseReleased(java.awt.event.MouseEvent evt)
			{
				System.out.println("evt=" + evt);
			}
		});
		f.addWindowListener(new java.awt.event.WindowAdapter()
		{
			public void windowClosing(java.awt.event.WindowEvent evt)
			{
				System.exit(0);
			}
		});
		f.setVisible(true);
	}
}

Comments
EVALUATION This is kind of a longshot, but I wonder if this has anything to do with 4501485? ###@###.### 2001-09-17 I tried setting the middle "button" (the wheel) on my IntelliMouse to "Back" in the Mouse control panel. This acts like the Back button (as expected) in Netscape and IE. In the test case, I do get KeyEvents: evt=java.awt.event.KeyEvent[KEY_PRESSED,keyCode=18,keyChar='?'] on canvas0 evt=java.awt.event.KeyEvent[KEY_PRESSED,keyCode=37,Left] on canvas0 evt=java.awt.event.KeyEvent[KEY_RELEASED,keyCode=37,Left] on canvas0 evt=java.awt.event.KeyEvent[KEY_RELEASED,keyCode=18,keyChar='?'] on canvas0 evt=java.awt.event.KeyEvent[KEY_TYPED,keyCode=0,keyChar=','] on canvas0 Perhaps the problem lies in how the Logitec drive delivers the simulated key events. ###@###.### 2002-09-06 This bug can be reproduced in jdk1.4.0. Beginning from jdk1.4.2 only four correct events are recieved: evt=java.awt.event.KeyEvent[KEY_PRESSED,keyCode=18,keyChar='?'] on canvas0 evt=java.awt.event.KeyEvent[KEY_PRESSED,keyCode=37,Left] on canvas0 evt=java.awt.event.KeyEvent[KEY_RELEASED,keyCode=37,Left] on canvas0 evt=java.awt.event.KeyEvent[KEY_RELEASED,keyCode=18,keyChar='?'] on canvas0 So it looks like this is duplicate of bug 4737679 Alt+Left/right/up/down generate characters in JTextArea ###@###.### 2005-01-21 ###@###.### 2005-1-21 09:43:44 GMT
21-01-2005