A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Swing / AWT / SWT
Monospaced font on a JMenuItem
Joined: Apr 11, 2005
May 18, 2007 08:51:00
Hi, I'd like to use a monospaced font within a
I guess its possible to use html to do this inside the
, but this plays up when you use spaces.
Is there another way, eg using Fonts?
Joined: Dec 27, 2002
May 18, 2007 09:17:00
Sure, just use the following:
jMenuItemName.setFont(new java.awt.Font("Monospaced", 0, 12));
Or were you wanting only a portion of the text to be monospace?
[ May 18, 2007: Message edited by: Darrin Cartwright ]
Life is good on the Ponderosa,<br />but mind where you step.
It is sorta covered in the
JavaRanch Style Guide
subject: Monospaced font on a JMenuItem
Tips on using this discussion software
Print plain text with Printable interface
Why the result of printing out the not-letter chars to console is different from to applets
problem with spacing of text in JTextArea
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013