-
Bug
-
Resolution: Fixed
-
P2
-
1.1.7
-
b01
-
sparc
-
solaris_2.6
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2021931 | 1.2.0 | Andy Herrick | P2 | Resolved | Fixed | 1.2fcs |
When adding a menu, the size of frame is changed correctly. (See Fig.B)
And then if you remove a menu for a frame, the size of frame becomes wrong. (See Fig.C)
It should be the size which was before adding it. In the figure below, Fig.A should be displayed.
A B C
============ =========== =======
| | ==> | menu | ==> -------
| | -----------
| | | |
------------ | |
| |
-----------
It only happens on Solaris under the following environment.
OS: Solaris 2.6 (EUC)
HW: SPARC
JDK: JDK117 build "D"
OS: Solaris 2.6 (PCK)
HW: X86
JDK: JDK117 build "D"
Windows95 and WindowsNT4.0 don't have this kind of problem.
The same bug was reported in 1.1.1 and was fixed in 1.1.5 and was verified in 1.1.5 and 1.1.6.
Please see 4028130.
I can't see this bug in JDK1.1.6. So this is exactly a degrade from 1.1.6.
Please fix this before FCS.
Here is a code to reproduce:
import java.awt.*;
import java.awt.event.*;
public class MenuTest implements ActionListener, WindowListener {
Frame fp;
MenuBar menu;
Button bAgain, bNull;
public static void main(String args[]) {
new MenuTest().run(args);
}
void run(String args[]) {
fp = new Frame();
fp.addWindowListener(this);
fp.add("West", bAgain = new Button("TRY:ADD"));
fp.add("East", bNull = new Button("TRY:REMOVE"));
bAgain.addActionListener(this);
bNull.addActionListener(this);
fp.pack();
fp.show();
}
void quit() {
fp.dispose();
System.exit(0);
}
/* action listener */
public void actionPerformed(ActionEvent e) {
if(e.getSource() == bAgain) {
menu = new MenuBar();
menu.add(new Menu("BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));
menu.add(new Menu("BZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"));
menu.add(new Menu("BXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"));
} else if(e.getSource() == bNull) {
menu = null;
}
fp.setMenuBar(menu);
System.out.println("Frame size:" + fp.getSize().toString());
System.out.println("Button size:" + bAgain.getSize().toString());
}
/* WindowListener */
public void windowOpened(WindowEvent e) {
System.out.println("Frame size:" + fp.getSize().toString());
System.out.println("Button size:" + bAgain.getSize().toString());
}
public void windowClosing(WindowEvent e) {
quit();
}
public void windowClosed(WindowEvent e) {
}
public void windowIconified(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
}
public void windowActivated(WindowEvent e) {
}
public void windowDeactivated(WindowEvent e) {
}
}
And then if you remove a menu for a frame, the size of frame becomes wrong. (See Fig.C)
It should be the size which was before adding it. In the figure below, Fig.A should be displayed.
A B C
============ =========== =======
| | ==> | menu | ==> -------
| | -----------
| | | |
------------ | |
| |
-----------
It only happens on Solaris under the following environment.
OS: Solaris 2.6 (EUC)
HW: SPARC
JDK: JDK117 build "D"
OS: Solaris 2.6 (PCK)
HW: X86
JDK: JDK117 build "D"
Windows95 and WindowsNT4.0 don't have this kind of problem.
The same bug was reported in 1.1.1 and was fixed in 1.1.5 and was verified in 1.1.5 and 1.1.6.
Please see 4028130.
I can't see this bug in JDK1.1.6. So this is exactly a degrade from 1.1.6.
Please fix this before FCS.
Here is a code to reproduce:
import java.awt.*;
import java.awt.event.*;
public class MenuTest implements ActionListener, WindowListener {
Frame fp;
MenuBar menu;
Button bAgain, bNull;
public static void main(String args[]) {
new MenuTest().run(args);
}
void run(String args[]) {
fp = new Frame();
fp.addWindowListener(this);
fp.add("West", bAgain = new Button("TRY:ADD"));
fp.add("East", bNull = new Button("TRY:REMOVE"));
bAgain.addActionListener(this);
bNull.addActionListener(this);
fp.pack();
fp.show();
}
void quit() {
fp.dispose();
System.exit(0);
}
/* action listener */
public void actionPerformed(ActionEvent e) {
if(e.getSource() == bAgain) {
menu = new MenuBar();
menu.add(new Menu("BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));
menu.add(new Menu("BZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"));
menu.add(new Menu("BXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"));
} else if(e.getSource() == bNull) {
menu = null;
}
fp.setMenuBar(menu);
System.out.println("Frame size:" + fp.getSize().toString());
System.out.println("Button size:" + bAgain.getSize().toString());
}
/* WindowListener */
public void windowOpened(WindowEvent e) {
System.out.println("Frame size:" + fp.getSize().toString());
System.out.println("Button size:" + bAgain.getSize().toString());
}
public void windowClosing(WindowEvent e) {
quit();
}
public void windowClosed(WindowEvent e) {
}
public void windowIconified(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
}
public void windowActivated(WindowEvent e) {
}
public void windowDeactivated(WindowEvent e) {
}
}
- backported by
-
JDK-2021931 JDK117[Solaris]: Adding/Removing a menu causes frame to unexpected small size
- Resolved
- relates to
-
JDK-4028130 replacing menubar causes frame to migrate upwards
- Closed