Customer is developing and using his application on Solaris 2.7.(JDK 1.1.6). But his pop-up utility does'nt work well on x86, which works well on sparc. Clicking with the right mouse button of a 2-button mouse on the swing based applet doesn't produce the pop up menu it is supposed to.
The application is written entirely in Swing 1.0.3; however, the way we are responding to mouse events is actually inherited from the old AWT: we override the processMouseEvent(MouseEvent e) method of a JTable. If e.isPopupTrigger() evaluates to TRUE, we display the popup menu. Even under the old AWT, this method is supposed to know which mouse button triggers the
popup (i.e. button 2 for a 2-button mouse or button 3 for a 3-button mouse).
Attached are a java file and the corresponding html to launch the applet. It seems that the problem only shows up with netscape (NSCPcom version 4.05.22.1)/(Even 4.5) using java plugin version 1.1.1
The attached demos work with appletviewer and hotjava but fail with netscape on a two button mouse machine.
mouseDemo.java:
import com.sun.java.swing.*;
import java.awt.*;
import java.awt.event.*;
public class mouseDemo extends JApplet {
private static mouseFrame thisFrame;
public static void main(String args[]) {
JFrame frame = new JFrame();
frame.setSize(200,100);
thisFrame = new mouseFrame();
frame.getContentPane().add(thisFrame);
frame.setVisible(true);
return;
}
public void init() {
super.init();
thisFrame = new mouseFrame();
getContentPane().add(thisFrame);
setVisible(true);
}
public static class mouseFrame extends JLabel {
public mouseFrame() {
super();
setText("SYSTEM READY");
setSize(100,50);
enableEvents(AWTEvent.MOUSE_EVENT_MASK);
setVisible(true);
}
public void processMouseEvent(MouseEvent e) {
if(e.isPopupTrigger()) {
setText("POPUP TRIGGER");
}
else {
setText(" ");
}
}
}
}
mouseDemo.html:
<HTML>
<HEAD>
<TITLE>Mouse Demo</TITLE>
</HEAD>
<BODY>
<H1>This is a demo of the mouse class</H1>
<P>
<CENTER>
<EMBED
type="application/x-java-applet;version=1.1.1"
java_CODE = "mouseDemo.class"
WIDTH = 150 HEIGHT = 50
pluginspage="http://java.sun.com/products/plugin/1.1.1/plugin-install.html"
></EMBED> <P>
<APPLET
CODE = mouseDemo.class
ARCHIVE = "swing.jar"
WIDTH = 150
HEIGHT = 50
></APPLET>
</CENTER>
</BODY></HTML>
kalpesh.shah@eng 1999-03-15
The application is written entirely in Swing 1.0.3; however, the way we are responding to mouse events is actually inherited from the old AWT: we override the processMouseEvent(MouseEvent e) method of a JTable. If e.isPopupTrigger() evaluates to TRUE, we display the popup menu. Even under the old AWT, this method is supposed to know which mouse button triggers the
popup (i.e. button 2 for a 2-button mouse or button 3 for a 3-button mouse).
Attached are a java file and the corresponding html to launch the applet. It seems that the problem only shows up with netscape (NSCPcom version 4.05.22.1)/(Even 4.5) using java plugin version 1.1.1
The attached demos work with appletviewer and hotjava but fail with netscape on a two button mouse machine.
mouseDemo.java:
import com.sun.java.swing.*;
import java.awt.*;
import java.awt.event.*;
public class mouseDemo extends JApplet {
private static mouseFrame thisFrame;
public static void main(String args[]) {
JFrame frame = new JFrame();
frame.setSize(200,100);
thisFrame = new mouseFrame();
frame.getContentPane().add(thisFrame);
frame.setVisible(true);
return;
}
public void init() {
super.init();
thisFrame = new mouseFrame();
getContentPane().add(thisFrame);
setVisible(true);
}
public static class mouseFrame extends JLabel {
public mouseFrame() {
super();
setText("SYSTEM READY");
setSize(100,50);
enableEvents(AWTEvent.MOUSE_EVENT_MASK);
setVisible(true);
}
public void processMouseEvent(MouseEvent e) {
if(e.isPopupTrigger()) {
setText("POPUP TRIGGER");
}
else {
setText(" ");
}
}
}
}
mouseDemo.html:
<HTML>
<HEAD>
<TITLE>Mouse Demo</TITLE>
</HEAD>
<BODY>
<H1>This is a demo of the mouse class</H1>
<P>
<CENTER>
<EMBED
type="application/x-java-applet;version=1.1.1"
java_CODE = "mouseDemo.class"
WIDTH = 150 HEIGHT = 50
pluginspage="http://java.sun.com/products/plugin/1.1.1/plugin-install.html"
></EMBED> <P>
<APPLET
CODE = mouseDemo.class
ARCHIVE = "swing.jar"
WIDTH = 150
HEIGHT = 50
></APPLET>
</CENTER>
</BODY></HTML>
kalpesh.shah@eng 1999-03-15
- duplicates
-
JDK-4168006 Popup menu test fails on x86/Solaris 2.6 combination.
-
- Closed
-