Created
June 26, 2020 09:41
-
-
Save kentcollins/0eca12aaf51a6590860c69a2122dc217 to your computer and use it in GitHub Desktop.
StdLib way of changing the font face or size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
Font larger = new Font("Arial", Font.BOLD, 128); | |
StdDraw.setFont(larger); | |
StdDraw.text(0.5, 0.5, "OK"); | |
Font smaller = new Font("Times New Roman", Font.ITALIC, 64); | |
StdDraw.setFont(smaller); | |
StdDraw.text(0.6, 0.45, "Go!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The name of the font must refer to a system font loaded onto your system. Once setFont has been called, any further text() operations will use the new font.