mouseMoved modifiers incorrect in JApplet

When running my applet on my Mac (through Firefox or Safari) the modifiers (ctrl, shift, alt) don't seem to be correct in the mouseMoved function. This bug doesn't happen on Windows or while running the applet through appletviewer.

Here's my demo code:

import java.awt.BorderLayout;

import java.awt.Graphics;

import java.awt.event.MouseEvent;

import java.awt.event.MouseMotionListener;

import javax.swing.JApplet;

import javax.swing.JPanel;

publicclass AppletMouseTestextends JApplet

{

private AppletMousePanel panel;

publicvoid init()

{

panel =new AppletMousePanel();

panel.setSize(600, 600);

getContentPane().setLayout(new BorderLayout());

getContentPane().add("Center", panel);

}

publicvoid destroy(){}

publicvoid start(){}

publicvoid stop(){}

publicclass AppletMousePanelextends JPanelimplements MouseMotionListener

{

privateint MAX = 100;

private String[] buffer =new String[MAX];

privateint lastIndex = -1;

AppletMousePanel()

{

addMouseMotionListener(this);

}

publicvoid paintComponent(Graphics g)

{

super.paintComponent(g);

for(int i=0; i<MAX; i++)

{

String str = buffer[(lastIndex-i+MAX)%MAX];

if(str !=null)

g.drawString(str, 10, 10+i*20);

}

}

publicvoid mouseMoved(MouseEvent e)

{

lastIndex = (lastIndex+1)%MAX;

buffer[lastIndex] = System.currentTimeMillis()+" mouseMoved "+MouseEvent.getMouseModifiersText(e.getModifiers());

repaint();

}

publicvoid mouseDragged(MouseEvent e)

{

lastIndex = (lastIndex+1)%MAX;

buffer[lastIndex] = System.currentTimeMillis()+" mouseDragged "+MouseEvent.getMouseModifiersText(e.getModifiers());

repaint();

}

}

}

and my html file:

><html>

<title>Mouse Tester Applet</title>

<applet code="AppletMouseTest" width="100%" height="100%" />

</html>

When you run through applet viewer, you will get mouseDragged and mouseMoved messages that properly list which modifier keys are down. When using the html file in Firefox, the mouseMoved messages never list any modifiers at all (mouseDragged works properly). When using the html file in Safari, the mouseMoved messages list the proper modifiers, but as soon as the main mouse button is pressed (while ctrl is down) no messages (mouseMoved or mouseDragged) are received at all.

I'm baffled. Does anyone have any ideas?

[4703 byte] By [gameCoderChicka] at [2007-11-27 10:59:25]
# 1

Adding some Dukes for encouragement...

gameCoderChicka at 2007-7-29 12:22:59 > top of Java-index,Desktop,Core GUI APIs...