// Basic GUI import javax.swing.*; public class Basic { public static void main(String[] args) { // Create window: JFrame f = new JFrame("Basic Test!"); // Set 500x500 pixels^2: f.setSize(500,500); // Show the window: f.setVisible(true); // Quit Java after closing the window: f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } // Basic2 GUI import javax.swing.*; public class Basic2 { public static void main(String[] args) { new MyGUI(); } } class MyGUI { { JFrame f = new JFrame("Basic Test2!"); f.setSize(500,500); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } // Basic3 GUI import javax.swing.*; import java.awt.*; // need for Point and Color classes public class Basic3 { public static void main(String[] args) { // Create window: JFrame f = new JFrame("Basic Test!"); // Set size of 500x500 pixels^2: f.setSize(500,500); // Move window 100 pixels W and 100 pixels S: f.setLocation(new Point(100,100)); // Make the background blue: f.setBackground(Color.blue); // Show the window f.setVisible(true); // Quit Java after closing the window: f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } // AddStuff import javax.swing.*; public class AddStuff { public static void main(String[] args) { JFrame f = new JFrame("AddStuff"); f.setSize(500,500); // Add Button to center // (uses default layout manager): f.getContentPane().add(new JButton("Button")); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } // AddStuff2 import javax.swing.*; import java.awt.*; public class AddStuff2 { public static void main(String[] args) { new MyGUI(); } } class MyGUI { private JFrame f; private Container c; public MyGUI() { f = new JFrame("AddStuff2"); f.setSize(500,500); c = f.getContentPane(); c.setLayout(new FlowLayout(FlowLayout.LEFT) ); for (int b = 1; b < 9;b++) c.add(new JButton("Button "+b)); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } // AddStuff3 import javax.swing.*; import java.awt.*; public class AddStuff3 { public static void main(String[] args) { new MyGUI(); } } class MyGUI { private JFrame f; private Container c; private LayoutManager l; private MyPanel[] p; private int dim; public MyGUI() { makeWindow(); showWindow(); } private void makeWindow() { dim = 4; f = new JFrame("AddStuff3"); p = new MyPanel[dim*dim]; c = f.getContentPane(); l = new GridLayout(dim,dim,2,2); c.setLayout(l); for (int i=0;i