Font Formatter is a Java application that allows user to manipulate font in different ways like font type, font size, and font style. This Font Formatter Java application shows the use of font utility that can be used in many other programs.
!!!!!!!!!!....Applet may take some time to load....!!!!!!!!!!
1.) Select the type of font from the options in combo box.
2.) Select the size of font form the second combo box.
3.) Check or uncheck the Bold or Italic check box to change the style of font.
4.) Press Quit Button to Quit.
To get the available fonts list in Java a toolkit object is used. A toolkit object contains the list of the available fonts which can be fetched using a in build method.
String[ ] fontList; fontList = Toolkit.getDefaultToolkit().getFontList(); |
In this program a createFontChoice() function is written for making a combo box list of available fonts.
private void createFontChoice() { fontChoice.addItemListener(this); String[] fontList; fontList = Toolkit.getDefaultToolkit().getFontList(); for(int i=0; i<fontlist.length; i++){ fontChoice.addItem(fontList[i]); } fontName = fontList[0]; } |