Setting Font to awt MenuItem will not effect its Font display, How ever, The font size , font style properties are updated.
I have used this property to set MenuItem font :
The above statement effects the swing JMenuItems, but awt MenuItems are not effected at all.
later i set the font property of each MenuItem, Then the font size, font style are effected. but font is not displayed.
I am able to set the font size, font style of awt MenuItems, but not displaying font. If i change the font, the same old default font is displaying with new style and size.
How to solve this issue ?
From the API, AWT's MenuComponent's setFont() method is inherited from Component. It is noted that setFont() may not work on all platforms, leaving the font unchanged. Swing's JMenuComponent's setFont() is inherited from JComponent, overriding Component's setFont(). The same limitation is not mentioned.
So the code is different. You could download the source code to determine the differences and better understand why the two setFont() methods provide different results.
Swing is preferred over AWT for many reasons, and use of AWT is generally discouraged where Swing alternatives exist.
Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
Thanks for the replay,
Yes, i always want to use Swing instead of AWT. But presently in application i want system tray access. TrayIcon class has method only. That is the problem here. Any way is there any way to set uni code fonts to the components of PopupMenu ??
UIManager does not work for AWT, only for Swing. As for the results of setFont not being used, that's possibly because of how the tray icon is implemented. I fear that if that method isn't working, nothing will be working apart from perhaps writing your own tray icon implementation.
Thanks for the responses,
The given links contain, the exact problem i am facing. I have expected the swing version of tray icon in jdk7. After the release of JDK7 i have searched javadocs interestingly for that component.
Here my application perfectly runs in ubuntu linux with all unicode characters displaying. But of course the look and feel is motif, so it is not so aesthetically pleasing when compared to other look and feels. Anyway i came to conclude that, displaying PopupMenu will be dependent on implementation of JVM and Underlying platform, Otherwise i have to use other third party implementations.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com