<<< A1 Getting Started using the Swing     Index     Swing Components >>>

// @topic T11615 Swing demo A1
// @brief Minimal JFrame and JButton example
/*
 * @author ik
 *
 */

package pckg;

import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
import javax.swing.text.*;

public class SwingMain
{
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }//main

    public static void createAndShowGUI() {
        // Swing test
        JFrame frame = new JFrame("JFrame is me");
        frame.setBounds(0, 0, 400, 300);

        JButton button = new JButton("Hello");
        frame.getContentPane().add(button); // add button to layout

        frame.setVisible(true);
    } //createAndShowGUI
} //SwingMain

<<< A1 Getting Started using the Swing     Index     Swing Components >>>