package com.mindprod.example;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Color;
import java.awt.Container;
import static java.lang.System.*;
/**
* demonstrate the use of javax.swing.JFrame.
*
* @author Roedy Green, Canadian Mind Products
* @version 1.0 2009-01-01 initial version
* @since 2009-01-01
*/
@SuppressWarnings( { "UnusedDeclaration" } )
final class TestJFrame
{
/**
* height of frame in pixels
*/
private static final int height = 100;
/**
* width of frame in pixels
*/
private static final int width = 300;
private static final String RELEASE_DATE = "2006-03-06";
/**
* title for frame
*/
private static final String TITLE_STRING = "JFrame Demo";
/**
* program version
*/
private static final String VERSION_STRING = "1.0";
/**
* Debugging harness for a JFrame
*
* @param args command line arguments are ignored.
*/
@SuppressWarnings( { "UnusedParameters" } )
public static void main( String args[] )
{
SwingUtilities.invokeLater( new Runnable()
{
/**
* } fire up a JFrame on the Swing thread
*/
public void run()
{
try
{
UIManager.setLookAndFeel( new com.sun.java.swing.plaf.motif.MotifLookAndFeel() );
}
catch ( Exception e )
{
err.println();
e.printStackTrace( err );
err.println( "Problem setting look and feel" );
err.println();
}
JFrame.setDefaultLookAndFeelDecorated( true );
final JFrame jframe = new JFrame( TITLE_STRING + " " + VERSION_STRING );
Container contentPane = jframe.getContentPane();
jframe.setSize( width, height );
contentPane.setBackground( Color.YELLOW );
contentPane.setForeground( Color.BLUE );
jframe.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
contentPane.add( new JLabel( "Test" ) );
jframe.validate();
jframe.setVisible( true );
}
} );
}
}