-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
None
-
1.2.2
-
x86
-
windows_95
Name: clC74495 Date: 09/14/99
The applet made by using JDK1.1.2 dosen't work properly when
using Java-plugin(ver1.2.2), in the following case;
The label of the PopupMenu object related to Button object is
not displayed when the Button is clicked(Right button pressed).
Instead, there displayed the label of that Button.
As far as I have tested, such problems occur also with List object,
but not with Label or Frame object.
Sample source code is below;
public class DialogTestApplet extends Applet implements ActionListener {
private Panel Panel1 = new Panel();
private Button Button1 = new Button( "Dialog" );
private Label Label1 = new Label( "Label1" );
private MyDialog Dialog1 = null;
private PopupMenu pm2 = new PopupMenu();
private ScrollPane scrollPane = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED) ;
private Panel scrollPanel = new Panel() ;
private MyCanvas scrollCanvas = new MyCanvas();
private PopupHelpMouseListener phml = new PopupHelpMouseListener();
private MyContainer scrollContainer = new MyContainer();
private TextField inputField = new TextField("abc");;
public DialogTestApplet() {
}
public void init() {
scrollPanel.setLayout( null );
Panel1.add( Button1 );
Panel1.add( Label1 );
add( Panel1 );
scrollCanvas.setSize( 500, 400 );
scrollPanel.setSize( 500, 400 );
scrollPane.setSize( 400, 300 );
inputField.setBounds( 50, 50, 40, 20 );
scrollPanel.add( inputField );
scrollPanel.add( scrollCanvas );
scrollPane.add( scrollPanel );
add( scrollPane );
Button1.addActionListener( this );
Component co = this;
while(!((co = co.getParent()) instanceof Frame)){}
Frame f = (Frame)co;
Dialog1 = new MyDialog( f );
//naming Menu1 to PopupMenu
pm2.add( "Menu1" );
add( pm2 );
Label1.addMouseListener( phml );
Button1.addMouseListener( phml );
}
public void close() {
System.out.println( "close" );
}
public void destroy() {
System.out.println( "destroy" );
}
public void actionPerformed(ActionEvent e) {
Dialog1.show();
if ( scrollContainer.isVisible() == true ) {
scrollContainer.setVisible( false );
} else {
scrollContainer.setVisible( true );
}
}
}
//Define PopupHelpMouseListner
protected class PopupHelpMouseListener extends MouseAdapter {
/**
* get event
*
* @param e Mouse button event
*/
public void mouseReleased(MouseEvent e) {
// Behavior when right button clicked
if (e.getModifiers() == InputEvent.BUTTON3_MASK) {
System.out.println( "e.getComponent=" + e.getComponent() );
pm2.show( e.getComponent(), 1, 1 );
}
}
}
(Review ID: 95223)
======================================================================