// // simple example of the Java AWT -- make two frames, using our // extension to Frame class, and display a string in each. // // this example is exactly like ShowString1, except that it creates // two windows, one displaying a string in lowercase and the // other displaying the same string in uppercase, and the windows // are instances of our CloseableFrame class, which does respond // to window-closing events. when both windows have been closed, // the application exits. // // see main method below for command-line arguments (same as for // ShowString1). // import java.awt.* ; class ShowString2 { // // command-line argument is string S to display (if none, // defaults to "Hello!"). public static void main(String[] args) { String s ; if (args.length > 0) s = args[0] ; else s = "Hello!" ; // make a window-plus-titlebar and center // s.toLowerCase() in it. CloseableFrame f1 = new CloseableFrame("Title 1") ; f1.add(new Label(s.toLowerCase(), Label.CENTER), "Center") ; f1.pack() ; f1.show() ; // make a window-plus-titlebar and center // s.toUpperCase() in it. CloseableFrame f2 = new CloseableFrame("Title 2") ; f2.add(new Label(s.toUpperCase(), Label.CENTER), "Center") ; f2.pack() ; f2.show() ; } }