-
Bug
-
Resolution: Fixed
-
P4
-
5.0
-
b35
-
generic
-
generic
Under XAWT, when there are more menus than can fit in a MenuBar AND there is a Help menu at the right hand side, the Help menu overlaps the other Menus. This looks bad.
Under MAWT, when there are too many menus, the Help menu is no longer displayed. This looks better, and has been the behavior since (at least) 1.1.8.
XAWT should behave the same as MAWT and hide the Help menu under these circumstances.
I used the following test case. Just press the "Add Menu" button until you fill up the MenuBar.
// test Menu.setHelpMenu()
import java.awt.*;
import java.awt.event.*;
public class HelpMenu implements ActionListener {
static MenuBar mb;
static HelpMenu hm;
static Button addMenu;
static Button addHelp;
public static void main(String[] args) {
hm = new HelpMenu();
Frame f = new Frame("HelpMenu");
f.setSize(600, 200);
mb = new MenuBar();
mb.add(createNewMenu());
mb.setHelpMenu(createNewHelpMenu());
mb.add(createNewMenu());
f.setMenuBar(mb);
f.setLayout(new FlowLayout());
addMenu = new Button("Add Menu");
addMenu.addActionListener(hm);
f.add(addMenu);
addHelp = new Button("Set New Help Menu");
addHelp.addActionListener(hm);
f.add(addHelp);
f.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == addMenu) {
mb.add(createNewMenu());
}
else if (e.getSource() == addHelp) {
mb.setHelpMenu(createNewHelpMenu());
}
}
private static int menuNum = 0;
public static Menu createNewHelpMenu() {
menuNum++;
Menu helpMenu = new Menu("HelpMenu " + menuNum);
helpMenu.add("Help Item " + menuNum);
helpMenu.add("Help Item " + menuNum);
return helpMenu;
}
public static Menu createNewMenu() {
Menu menu = new Menu("Menu");
menu.add("Item 1");
menu.add("Item 2");
return menu;
}
}
This was files as part of 4958729.
Under MAWT, when there are too many menus, the Help menu is no longer displayed. This looks better, and has been the behavior since (at least) 1.1.8.
XAWT should behave the same as MAWT and hide the Help menu under these circumstances.
I used the following test case. Just press the "Add Menu" button until you fill up the MenuBar.
// test Menu.setHelpMenu()
import java.awt.*;
import java.awt.event.*;
public class HelpMenu implements ActionListener {
static MenuBar mb;
static HelpMenu hm;
static Button addMenu;
static Button addHelp;
public static void main(String[] args) {
hm = new HelpMenu();
Frame f = new Frame("HelpMenu");
f.setSize(600, 200);
mb = new MenuBar();
mb.add(createNewMenu());
mb.setHelpMenu(createNewHelpMenu());
mb.add(createNewMenu());
f.setMenuBar(mb);
f.setLayout(new FlowLayout());
addMenu = new Button("Add Menu");
addMenu.addActionListener(hm);
f.add(addMenu);
addHelp = new Button("Set New Help Menu");
addHelp.addActionListener(hm);
f.add(addHelp);
f.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == addMenu) {
mb.add(createNewMenu());
}
else if (e.getSource() == addHelp) {
mb.setHelpMenu(createNewHelpMenu());
}
}
private static int menuNum = 0;
public static Menu createNewHelpMenu() {
menuNum++;
Menu helpMenu = new Menu("HelpMenu " + menuNum);
helpMenu.add("Help Item " + menuNum);
helpMenu.add("Help Item " + menuNum);
return helpMenu;
}
public static Menu createNewMenu() {
Menu menu = new Menu("Menu");
menu.add("Item 1");
menu.add("Item 2");
return menu;
}
}
This was files as part of 4958729.
- relates to
-
JDK-4958729 REGRESSION: MenuBar behaves incorrectly sometimes
-
- Closed
-