// // simple example of the Java AWT -- make a frame and display a string // within it. // // note that Frame class makes a window-plus-titlebar, compatible // with your window manager (Windows, X, etc.). you should be // able to move the window around and resize it. // note however that to stop this application you must enter control-C; // the Frame class doesn't respond to window-closing events. // // see main method below for command-line arguments. // import java.awt.* ; class ShowString1 { // // 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. default layout is // BorderLayout. Frame f = new Frame("A Title") ; // add the string (as a centered label) to the // center region of the frame. f.add(new Label(s, Label.CENTER), "Center") ; // set size of window to minimum required to display // its components (the Label containing our // string to display). f.pack() ; // make the window visible. f.show() ; } }