JMU
Creating "Nifty" Assignments for Java Programming Courses
and a Discussion of the Necessary Aspects of Java


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu


Purpose
A Quick Look Ahead
Part 1

Graphical User Interfaces

The Building Blocks of GUIs
Some Top-Level Containers (i.e., Realizations of JRootPaneContainer javax.swing.JRootPaneContainer )
Creating a JFrame
javaexamples/gui/JFrameDriver.java
        import java.awt.*;
import javax.swing.*;


/**
 * An example that uses a JFrame
 *
 * @version 1.0
 * @author  Prof. David Bernstein, James Madison Univeristy
 */
public class JFrameDriver
{

    /**
     * The entry point of the example
     *
     * @param args   The command line arguments
     */
    public static void main(String[] args)
    {
        JFrame   f;


        f = new JFrame();
        f.setSize(400,400);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        
        f.setVisible(true);
    }
}
        
Working with Top-Level Containers
Some GUI Components
GUI Layout
Absolute Layout

The "Graph Paper" Approach

images/layout_absolute1.gif
Absolute Layout in Java

The null LayoutManager java.awt.LayoutManager

javaexamples/layout/NullLayoutFrame.java