import java.awt.*; 
import java.awt.event.*; 
import javax.swing.*; 

class testFont extends JPanel { 
      //String[] type = { "Serif","SansSerif"}; 
//      String[] type = { "Serif","Kredit","Yu Gothic","YGO13D","YMjO24ks"}; 
      String[] type = { "Serif","YGO13D","YMjO24ks"}; 
      int[] styles = { Font.PLAIN, Font.ITALIC, Font.BOLD, Font.ITALIC + Font.BOLD }; 
      String[] stylenames = { "Plain", "Italic", "Bold", "Bold & Italic" }; 

      @Override
      public void paint(Graphics g) { 
         for (int f = 0; f < type.length; f++) { 
            for (int s = 0; s < styles.length; s++) { 
               Font font = new Font(type[f], styles[s], 18); 
               g.setFont(font); 
               String name = type[f] + " " + stylenames[s]; 

               int indexUnsupportedCharacter = font.canDisplayUpTo(name); 
               if (indexUnsupportedCharacter != -1) 
               { 
                   System.out.println("There is at least one character in text '" + name + "' that is not contained in font " + 

                    font.getFontName() + ": "+ name.substring(indexUnsupportedCharacter, indexUnsupportedCharacter+1)); 

               } 
                
               g.drawString(name, 20, (f * 4 + s + 1) * 20); 
            } 
         } 
      } 

      public static void main(String[] a) { 
         JFrame f = new JFrame(); 
         f.addWindowListener(new WindowAdapter() { 
            @Override
            public void windowClosing(WindowEvent e) { 
               System.exit(0); 
            } 
         } 
      ); 

      f.setContentPane(new testFont()); 
      f.setSize(400,400); 
      f.setVisible(true); 
   } 
} 
