/** * Author: Josiah Yoder et al. * Class: SE1021-031 * Date: 1/7/14 10:31 AM * Lesson: Week 4, Day 2 */ package example4_2; import javax.swing.*; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class SimpleWindow extends JFrame { private final static int WIDTH = 700; private final static int HEIGHT = 400; public static void main(String[] args) { JFrame gui = new SimpleWindow(); } public SimpleWindow() { setTitle("Dog and Pony Show"); setSize(WIDTH, HEIGHT); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout()); final JLabel l = new JLabel("Dog"); add(l); add(new JTextField("my field",5)); JButton button = new JButton("asdf"); button.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { System.out.println("This is the inner-classes' actionPerformed method"); System.out.println("l: " + l.getName()); } }); add(button); setVisible(true); } }