Unable to change font in java.awt.MenuBar

I'm trying to change the font in an AWT menu bar using MenuBar.setFont(). The call works for the menu bar's child menus, but the menu bar itself doesn't change font (I'm trying to make the font larger).

Does anyone know whether this is possible to do?

I'm using JRE 1.6 on Windows XP.

Update: Changing the font does seem to work so long as the text fits within the menu bar height, otherwise the font size is reduced.


Asked by: Adrian608 | Posted: 28-01-2022






Answer 1

Use Swing. I don't think that AWT is capable of restyling native component peers in a reliable fashion. I know for certain that SWT can't, and it's a far more sophisticated toolkit than AWT. This is part of why it was essentially deprecated (in favor of Swing) back in Java 1.2.

Answered by: Aldus436 | Posted: 01-03-2022



Similar questions





Still can't find your answer? Check out these amazing Java communities for help...



Java Reddit Community | Java Help Reddit Community | Dev.to Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)



top