Download this source file


// Simple Swing demo showing a JFrame with a JLabel.
// Written 1/2001 by Wayne Pollock, Tampa Florida USA.

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

public class SwingDemo1
{
   public static void main ( String [] args )
   {
      JFrame f = new JFrame( "Swing Demo #1" );
      f.setSize( 400, 300 );

//    f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );  // Java 1.3

      f.addWindowListener( new WindowAdapter()
         {  public void windowClosing( WindowEvent we )
            {  System.exit( 0 );  }
         }
      );

      Container c = f.getContentPane();
      JLabel lbl = new JLabel( " Howdy! ", JLabel.CENTER );
      c.add( lbl, "Center" );

      f.setVisible( true );
   }
}




Send comments and mail to the WebMaster.