Setting preferred and alternate fonts



I want to set my preferred sans-serif font to Helvetica, and have it use Arial if Helvetica is not available. Does the LookAndFeel class allow for this? Is there some other way of doing this that I am missing? I don’t want to embed a font in the program, as I haven’t found a decent free font for my purposes (if anyone knows of decent Grotesk style freebie out there, please let me know).


Sean Costello


Yep, there’s a L+F method to set the default fonts.


I have found that, but how do you set an alternative default font if your desired one isn’t found? I’m sure that there is a way to roll your own code to chose, but I wondered if this was built in already.




You’d need to get the list of fonts, and search it to see if the one you want is there, and pick another if it’s not.