import javax.swing.*;
/** Code from Leavning Java, Third Edition, p.31
A minimialist example of a Swing GUI (Graphical User Interface).
@author Patrick Niemeyer and Jonathan Knudsen
@version Learning Java, 3rd Edition
@see Link to p. 31 of Learning Java, Third Edition from on campus
@see Link from off campus
*/
public class HelloJava {
/** main method--must be run on a system with windows/graphics capability
@param args (unused)
*/
public static void main( String[ ] args ) {
JFrame frame = new JFrame( "Hello, Java!" ) ;
JLabel label = new JLabel("Hello, Java!", JLabel.CENTER ) ;
// This next line wasn't in the original HelloJava--it
// was added in HelloJava2 on p. 42. But if you don't have it
// it is sort of a pain, since you can't "X out" of the program.
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ) ;
frame.getContentPane() . add(label) ;
frame.setSize( 300, 300 ) ;
frame.setVisible( true ) ;
}
}