-
Bug
-
Resolution: Won't Fix
-
P3
-
None
-
5.0
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)
FULL OS VERSION :
Windows 2000 5.00.2195, Windows XP Professional
A DESCRIPTION OF THE PROBLEM :
I have just upgraded to the JRE 1.4.2_01 (FROM JRE 1.4.0). I found that the top level menu items on the AWT MenuBar which were usually displayed in SanSerifBOLD-24 are now being displayed in a smaller font size.
I have run through the code and called getfonts on all components in the menubar including itself and all return font sizes of 24. So why are the toplevel menu items being displayed at a smaller size?
I really need to get those toplevel menu items back to their original size of 24. The second-level menu items are being displayed at the correct size of 24. Are the top-level menu items being affected by the size of the menu bar - is there any way i can change that (if so)?
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a frame
2. Set a menu bar in it.
3. Add two or three top-level menu items.
4. To each top-level menu item add child menu items (ie: create FILE>NEW,OPEN)
5. Set the menu font for all items to be SansSerif, Bold, 24.
6. Run.
You will find that the top-level menu items are a smaller size (NOT 24) while the child items (or those below the first menu item) are all the correct font.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would expect ALL the menu items to be of size 24 not just the lower child items.
ACTUAL -
Currently the top level menu items (those visible on the menu bar before clicked) are a smaller size (looks 18 or 16). While the child menu items below the top level ones are of size 24.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;
public class test extends JFrame {
Menu menu;
MenuItem itemOne, itemTwo;
JLabel label;
public test() {
Font font = new Font("dialog", Font.BOLD, 24);
menu = new Menu("Test Menu");
menu.setFont(font);
itemOne = new MenuItem("Item One");
itemTwo = new MenuItem("Item Two");
menu.add(itemOne);
menu.add(itemTwo);
itemOne.setFont(font);
itemTwo.setFont(font);
MenuBar menuBar = new MenuBar();
menuBar.add(menu);
setMenuBar(menuBar);
label = new JLabel("Test Label", JLabel.CENTER);
getContentPane().add(label, "North");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(300,200);
setLocation(400,300);
setVisible(true);
investigateFonts();
}
private void investigateFonts() {
System.out.println("menu font = " + menu.getFont());
System.out.println("menu font size = " + menu.getFont().getSize());
System.out.println("itemOne font size = " + itemOne.getFont().getSize());
System.out.println("label font size = " + label.getFont().getSize());
}
public static void main(String[] args)
{ new test(); }
}
IF THE SAME PROGRAM WAS EXECUTED BUT USING SWING MENU COMPONENTS - IT WORKS AS EXPECTED. THIS ISSUE SEEMS LIMITED TO AWT MENU COMPONENTS.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
If I had one - i probably wouldn't have even submitted a bug report :)
Release Regression From : 1.3.1
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
Release Regression From : 1.3.1
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
###@###.### 2005-03-29 19:10:58 GMT
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)
FULL OS VERSION :
Windows 2000 5.00.2195, Windows XP Professional
A DESCRIPTION OF THE PROBLEM :
I have just upgraded to the JRE 1.4.2_01 (FROM JRE 1.4.0). I found that the top level menu items on the AWT MenuBar which were usually displayed in SanSerifBOLD-24 are now being displayed in a smaller font size.
I have run through the code and called getfonts on all components in the menubar including itself and all return font sizes of 24. So why are the toplevel menu items being displayed at a smaller size?
I really need to get those toplevel menu items back to their original size of 24. The second-level menu items are being displayed at the correct size of 24. Are the top-level menu items being affected by the size of the menu bar - is there any way i can change that (if so)?
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a frame
2. Set a menu bar in it.
3. Add two or three top-level menu items.
4. To each top-level menu item add child menu items (ie: create FILE>NEW,OPEN)
5. Set the menu font for all items to be SansSerif, Bold, 24.
6. Run.
You will find that the top-level menu items are a smaller size (NOT 24) while the child items (or those below the first menu item) are all the correct font.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would expect ALL the menu items to be of size 24 not just the lower child items.
ACTUAL -
Currently the top level menu items (those visible on the menu bar before clicked) are a smaller size (looks 18 or 16). While the child menu items below the top level ones are of size 24.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;
public class test extends JFrame {
Menu menu;
MenuItem itemOne, itemTwo;
JLabel label;
public test() {
Font font = new Font("dialog", Font.BOLD, 24);
menu = new Menu("Test Menu");
menu.setFont(font);
itemOne = new MenuItem("Item One");
itemTwo = new MenuItem("Item Two");
menu.add(itemOne);
menu.add(itemTwo);
itemOne.setFont(font);
itemTwo.setFont(font);
MenuBar menuBar = new MenuBar();
menuBar.add(menu);
setMenuBar(menuBar);
label = new JLabel("Test Label", JLabel.CENTER);
getContentPane().add(label, "North");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(300,200);
setLocation(400,300);
setVisible(true);
investigateFonts();
}
private void investigateFonts() {
System.out.println("menu font = " + menu.getFont());
System.out.println("menu font size = " + menu.getFont().getSize());
System.out.println("itemOne font size = " + itemOne.getFont().getSize());
System.out.println("label font size = " + label.getFont().getSize());
}
public static void main(String[] args)
{ new test(); }
}
IF THE SAME PROGRAM WAS EXECUTED BUT USING SWING MENU COMPONENTS - IT WORKS AS EXPECTED. THIS ISSUE SEEMS LIMITED TO AWT MENU COMPONENTS.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
If I had one - i probably wouldn't have even submitted a bug report :)
Release Regression From : 1.3.1
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
Release Regression From : 1.3.1
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
###@###.### 2005-03-29 19:10:58 GMT
- relates to
-
JDK-4958729 REGRESSION: MenuBar behaves incorrectly sometimes
-
- Closed
-
-
JDK-4700350 MenuBar does not work as expected
-
- Closed
-