![]() |
Help: Font list
Help is available for each task, or you can go straight to the solution source code.
Use getDefaultToolkit to get the current tool kit and then use getFontList to get the list of fonts as a String array. Task 2Define method paint so that it loops through the fonts, setting the current font and drawingfontList[i] + " 16 point Bold"in the current font. You will have to get the font height with getFontMetrics(f) where f is a Font so that you can avoid drawing the strings on top of each other. You must create a font with new Font(fontList[i], Font.BOLD, 16);and then set the font of the graphics context with setFont. |
Copyright © 1996-1997 MageLang Institute. All Rights Reserved. |