The AWT's MenuBar doesn't display all of its Menu correctly on Windows.
As demonstrated in the following program which should display:
________________________________________________________________
| one | two | three | Help2 | four | |
|_____|_____|_______|_______|______|___________________________|
On Windows the MenuBar only shows:
________________________________________________________________
| one | two | three | |
|_____|_____|_______|__________________________________________|
The "Help2" and "four" didn't show up on its slot but if you slide the
cursor over it and click on it, then there's a pulled down menu.
------------------------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
public class menuBar1 extends Frame {
public static void main(String argv[] ) {
menuBar1 m = new menuBar1();
}
public menuBar1 () {
setTitle("Test Frame");
show();
setSize(400, 200);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
System.exit(0);
}
});
MenuBar mb = new MenuBar();
Menu h1, h2;
setMenuBar(mb);
mb.add(createMenu("one", false));
mb.add(createMenu("two", false));
mb.add(createMenu("three", true));
mb.add(h1 = createMenu("Help 1", false)); // h1 is HelpMenu
mb.setHelpMenu(h1);
mb.add(h2 = createMenu("Help 2", false)); // h2 replaced h1
mb.setHelpMenu(h2);
mb.add(createMenu("four", false));
System.out.println(mb.getHelpMenu());
System.out.println(mb.getMenuCount());
}
Menu createMenu(String name, boolean tearoff) {
Menu m = new Menu(name, tearoff);
m.add(new MenuItem(name + " item 1"));
m.add(new MenuItem(name + " item 2"));
m.add(new MenuItem(name + " item 3"));
return m;
}
}
------------------------------------------------------------------------
Roger Pham 9/27/99
As demonstrated in the following program which should display:
________________________________________________________________
| one | two | three | Help2 | four | |
|_____|_____|_______|_______|______|___________________________|
On Windows the MenuBar only shows:
________________________________________________________________
| one | two | three | |
|_____|_____|_______|__________________________________________|
The "Help2" and "four" didn't show up on its slot but if you slide the
cursor over it and click on it, then there's a pulled down menu.
------------------------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
public class menuBar1 extends Frame {
public static void main(String argv[] ) {
menuBar1 m = new menuBar1();
}
public menuBar1 () {
setTitle("Test Frame");
show();
setSize(400, 200);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
System.exit(0);
}
});
MenuBar mb = new MenuBar();
Menu h1, h2;
setMenuBar(mb);
mb.add(createMenu("one", false));
mb.add(createMenu("two", false));
mb.add(createMenu("three", true));
mb.add(h1 = createMenu("Help 1", false)); // h1 is HelpMenu
mb.setHelpMenu(h1);
mb.add(h2 = createMenu("Help 2", false)); // h2 replaced h1
mb.setHelpMenu(h2);
mb.add(createMenu("four", false));
System.out.println(mb.getHelpMenu());
System.out.println(mb.getMenuCount());
}
Menu createMenu(String name, boolean tearoff) {
Menu m = new Menu(name, tearoff);
m.add(new MenuItem(name + " item 1"));
m.add(new MenuItem(name + " item 2"));
m.add(new MenuItem(name + " item 3"));
return m;
}
}
------------------------------------------------------------------------
Roger Pham 9/27/99
- duplicates
-
JDK-4275871 MenuBar doesn't display all of its Menus correctly on Windows
-
- Closed
-