import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class StaticCharMethods extends JFrame
 {
   private char c;
   private JLabel promptLabel;
   private JTextField inputField;
   private JTextArea outputArea;

   public  StaticCharMethods()
    {
      super("Static Character Methods");

      Container container = getContentPane();
      container.setLayout(new FlowLayout());

      promptLabel =
       new JLabel("Enter a character and press Enter");
      container.add(promptLabel);

      inputField = new JTextField(5);

      inputField.addActionListener

      (
       new ActionListener()
        {
         public void actionPerformed(ActionEvent event)
          {
            String s = event.getActionCommand();
            c = s.charAt(0);
            buildOutput();
           }
         }
       );

       container.add(inputField);

       outputArea=new JTextArea(10,20);
       container.add(outputArea);

       setSize(300,250);
       show();
      }

      public void buildOutput()

      {
      outputArea.setText
       (
        "is defined: " + Character.isDefined(c) +
        "\nis digit: " + Character.isDigit(c) +
        "\nis Java letter: " +
        Character.isJavaIdentifierStart(c) +
        "\nis Java letter of digit: " +
        Character.isJavaIdentifierPart(c) +
        "\nis letter: " + Character.isLetter(c) +
        "\nis letter or digit: " +
        Character.isLetterOrDigit(c) +
        "\nis lower case: " + Character.isLowerCase(c) +
        "\nis upper case: " + Character.isUpperCase(c) +
        "\nto upper case: " + Character.isUpperCase(c) +
        "\nto lower case: " + Character.isLowerCase(c));

       }

       public static void main(String args[])
        {
         StaticCharMethods application = new StaticCharMethods();

         application.addWindowListener
          (
           new WindowAdapter()
            {
             public void windowClosing(WindowEvent windowEvent)

             {
             System.exit(0);
             }
            }
           );
         }
      }
