All pastes #372489 Raw Edit

Plouj

public java v1 · immutable
#372489 ·published 2007-02-26 02:26 UTC
rendered paste body
import javax.swing.*;          import java.awt.*;import java.awt.event.*;public class ATMUI implements ActionListener {	// various strings	private final String programTitle = "ATM User Interface";	public Component createComponents() {		JButton button = new JButton("I'm a Swing button!");		button.addActionListener(this);		JPanel pane = new JPanel(new GridLayout(0, 1));		pane.add(button);		return pane;	}	public void actionPerformed(ActionEvent e) {	}	private static void createAndShowGUI() {		//Make sure we have nice window decorations		JFrame.setDefaultLookAndFeelDecorated(true);		//Create and set up the window		JFrame frame = new JFrame(programTitle);		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);		ATMUI app = new ATMUI();		Component contents = app.createComponents();		frame.getContentPane().add(contents, BorderLayout.CENTER);		//Display the window		frame.pack();		frame.setVisible(true);	}	public static void main(String[] args) {		//Schedule a job for the event-dispatching thread:		//creating and showing this application's GUI		javax.swing.SwingUtilities.invokeLater(new Runnable() {			public void run() {				createAndShowGUI();			}		});	}}