KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm messing around with DefaultStyledDocument and am trying to figure out the right way to set a style to the proper monospaced font. By "proper" I mean that the font selected is: A monospaced font that exists on the user's machine A font specified by the user's preferences (is there a standard way to do this in Java?) If there is no specified font, it will fall back on the standard monospaced font ("Monospaced"). This works: StyleConstants.setFontFamily(mainStyle, "Monospaced"); and this also works: StyleConstants.setFontFamily(mainStyle, "Lucida Console"); but I can't seem to figure out how to tell if the font family in question both exists on the user's machine (there's no return value to setFontFamily) and is a monospaced font. If I use "Lucida Consoleq" it seems to use whatever the default font is.
Tags (comma-separated)
Save Edits
Cancel