-
Bug
-
Resolution: Duplicate
-
P1
-
None
-
1.1.1
-
generic
-
solaris_2.5.1
Replacing the menuBar associated with a Frame causes the Frame's position
to change - this problem doesn't occur under Win32 in 1.1FCS or 1.1.1Beta.
To reproduce, run the testcase below, and click repeatedly on the button...
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class Movement extends Applet
implements ActionListener
{
Button mButton;
TextField mTextFld;
Frame mFrame;
MenuItem mMItem;
Menu mSubMenu;
MenuBar mTopMenu;
public Movement(Frame frame)
{
mFrame = frame;
}
public static void main(String argv[])
{
Frame frame = new Frame("Menu movement problems...");
Applet tmp = new Movement(frame);
frame.add(tmp, "Center");
frame.setSize(300, 300);
frame.show();
tmp.start();
}
public void start()
{
mButton = new Button("New Menu");
mButton.addActionListener(this);
add(mButton);
mTextFld = new TextField("Visible");
add(mTextFld);
mMItem = new MenuItem("Plain Item");
mMItem.addActionListener(this);
mSubMenu = new Menu("SubMenu");
mSubMenu.add(mMItem);
mTopMenu = new MenuBar();
mTopMenu.add(mSubMenu);
mFrame.setMenuBar(mTopMenu);
}
public void actionPerformed(ActionEvent event)
{
if ( event.getSource() == mMItem )
{
System.out.println("Plain Item handled.");
Toolkit.getDefaultToolkit().beep();
}
else if ( event.getSource() == mButton )
{
mFrame.setMenuBar(null);
mFrame.setMenuBar(mTopMenu);
}
}
}
to change - this problem doesn't occur under Win32 in 1.1FCS or 1.1.1Beta.
To reproduce, run the testcase below, and click repeatedly on the button...
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class Movement extends Applet
implements ActionListener
{
Button mButton;
TextField mTextFld;
Frame mFrame;
MenuItem mMItem;
Menu mSubMenu;
MenuBar mTopMenu;
public Movement(Frame frame)
{
mFrame = frame;
}
public static void main(String argv[])
{
Frame frame = new Frame("Menu movement problems...");
Applet tmp = new Movement(frame);
frame.add(tmp, "Center");
frame.setSize(300, 300);
frame.show();
tmp.start();
}
public void start()
{
mButton = new Button("New Menu");
mButton.addActionListener(this);
add(mButton);
mTextFld = new TextField("Visible");
add(mTextFld);
mMItem = new MenuItem("Plain Item");
mMItem.addActionListener(this);
mSubMenu = new Menu("SubMenu");
mSubMenu.add(mMItem);
mTopMenu = new MenuBar();
mTopMenu.add(mSubMenu);
mFrame.setMenuBar(mTopMenu);
}
public void actionPerformed(ActionEvent event)
{
if ( event.getSource() == mMItem )
{
System.out.println("Plain Item handled.");
Toolkit.getDefaultToolkit().beep();
}
else if ( event.getSource() == mButton )
{
mFrame.setMenuBar(null);
mFrame.setMenuBar(mTopMenu);
}
}
}
- duplicates
-
JDK-4028130 replacing menubar causes frame to migrate upwards
-
- Closed
-