570 Strings and Characters Chapter 10 49 50 (Msn web hosting)
570 Strings and Characters Chapter 10 49 50 container.add( inputField ); 51 52 outputArea = new JTextArea( 10, 20 ); 53 container.add( outputArea ); 54 55 setSize( 300, 250 ); // set the window size 56 show(); // show the window 57 } 58 59 // display character info in outputArea 60 public void buildOutput() 61 { 62 outputArea.setText( 63 “is defined: ” + Character.isDefined( c ) + 64 “nis digit: ” + Character.isDigit( c ) + 65 “nis Java letter: ” + 66 Character.isJavaIdentifierStart( c ) + 67 “nis Java letter or digit: ” + 68 Character.isJavaIdentifierPart( c ) + 69 “nis letter: ” + Character.isLetter( c ) + 70 “nis letter or digit: ” + 71 Character.isLetterOrDigit( c ) + 72 “nis lower case: ” + Character.isLowerCase( c ) + 73 “nis upper case: ” + Character.isUpperCase( c ) + 74 “nto upper case: ” + Character.toUpperCase( c ) + 75 “nto lower case: ” + Character.toLowerCase( c ) ); 76 } 77 78 // execute application 79 public static void main( String args[] ) 80 { 81 StaticCharMethods application = new StaticCharMethods(); 82 83 application.addWindowListener( 84 85 // anonymous inner class 86 new WindowAdapter() { 87 88 // handle event when user closes window 89 public void windowClosing( WindowEvent windowEvent ) 90 { 91 System.exit( 0 ); 92 } 93 94 } // end anonymous inner class 95 96 ); // end call to addWindowListener 97 98 } // end method main 99 100 } // end class StaticCharMethods Fig. 10.17 staticcharacter testing methods and case conversion methods of class Character(part 2 of 3). Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/7/01