Font in UI question.

M

MS

Hi,

At the moment I'm developing an application's UI using Netbeans and JDK 1.5.

When selecting swing components in a JFrame, the font property allows you
to set the font to any font installed on the OS. But what happens if you
select a font that is not installed on a machine that is running the
application? What font will it use instead?

The flip side of this question is: which fonts are most widely compatible?

Thanks,

MS
 
T

Thomas Weidenfeller

MS said:
When selecting swing components in a JFrame, the font property allows
you to set the font to any font installed on the OS. But what happens if
you select a font that is not installed on a machine that is running the
application? What font will it use instead?

This is undefined. However, in all the VMs I have seen the Font class
used a "Dialog" font when nothing similar could be found.
The flip side of this question is: which fonts are most widely compatible?

The so called logical fonts. They must exist on all compliant Java
implementations and may map to different physical fonts on different
systems. Since around 1.2 Sun's VM also comes with an own set of Lucida
fonts, which are also a good save bet.

See the API documentation and the I18N documentation that comes with
your JDK for details.

/Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top