-
Bug
-
Resolution: Fixed
-
P4
-
1.4.0
-
b01
-
generic
-
solaris_2.6
java.awt.MenuBar.setFont() doesn't set font correctly for the MenuBar
in:
jdk 1.3
jdk1.4 (solaris only).
java.awt.MenuComponent.setFont() spec says:
------------------------------------------
setFont
public void setFont(Font f)
Sets the font to be used for this menu component to the specified font. This
^^^^
font is also used by all subcomponents of this menu component, unless those
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
subcomponents specify a different font.
Parameters:
f - the font to be set.
See Also:
getFont()
----------------------------------------------
MenuBar.setFont() sets the font ONLY for the components that weren't already
added to the MenuBar. The Menus that were added to the MenuBar
before the setFont() call are still displayed using the default font.
An example below demonstartes the problem. The setFont() call changes
the font menu4, menu5 and menu6.
menu1, menu2, menu3 are still displayed in the old font.
This needs to be fixed. setFont() should change the font of ALL menus
in the MenuBar.
import java.awt.*;
public class menubar {
public static void main (String [] args) {
Frame f = new Frame();
MenuBar pm = new MenuBar();
f.setMenuBar(pm);
f.setSize(600, 100);
f.setVisible(true);
pm.add(new Menu("menu1"));
pm.add(new Menu("menu2"));
pm.add(new Menu("menu3"));
pm.setFont(new Font("Dialog", Font.BOLD, 30));
pm.add(new Menu("menu4"));
pm.add(new Menu("menu5"));
pm.add(new Menu("menu6"));
}
}
in:
jdk 1.3
jdk1.4 (solaris only).
java.awt.MenuComponent.setFont() spec says:
------------------------------------------
setFont
public void setFont(Font f)
Sets the font to be used for this menu component to the specified font. This
^^^^
font is also used by all subcomponents of this menu component, unless those
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
subcomponents specify a different font.
Parameters:
f - the font to be set.
See Also:
getFont()
----------------------------------------------
MenuBar.setFont() sets the font ONLY for the components that weren't already
added to the MenuBar. The Menus that were added to the MenuBar
before the setFont() call are still displayed using the default font.
An example below demonstartes the problem. The setFont() call changes
the font menu4, menu5 and menu6.
menu1, menu2, menu3 are still displayed in the old font.
This needs to be fixed. setFont() should change the font of ALL menus
in the MenuBar.
import java.awt.*;
public class menubar {
public static void main (String [] args) {
Frame f = new Frame();
MenuBar pm = new MenuBar();
f.setMenuBar(pm);
f.setSize(600, 100);
f.setVisible(true);
pm.add(new Menu("menu1"));
pm.add(new Menu("menu2"));
pm.add(new Menu("menu3"));
pm.setFont(new Font("Dialog", Font.BOLD, 30));
pm.add(new Menu("menu4"));
pm.add(new Menu("menu5"));
pm.add(new Menu("menu6"));
}
}
- relates to
-
JDK-4414827 java.awt.MenuBar.setFont() spec needs to be relaxed
-
- Resolved
-
-
JDK-4717864 setFont() does not update Fonts of Menus already on screen
-
- Resolved
-