All pastes #32394 Raw Edit

Unnamed

public java v1 · immutable
#32394 ·published 2005-12-04 18:37 UTC
rendered paste body
package learnjava.tonylewis;import javax.swing.*;import java.awt.*;import java.awt.event.*;public class HelloWorld extends JFrame {	private int input1 = 0;	private int input2 = 0;	private JTextField input1Field = new JTextField(input1);	private JTextField input2Field = new JTextField(input2);		private JPanel mainPanel, previousPanel, afterPanel;		public void HelloWorld() {		try {			UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");		} catch (Exception e) { }				System.out.println("Beginning Predictor [Copyright Jundo Ltd]");				//Create the phase selection and display panels.		previousPanel = new JPanel();		afterPanel = new JPanel();				//Create the main panel to contain the two sub panels.		mainPanel = new JPanel();		mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));		mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));		previousPanel.setLayout(new BorderLayout());		previousPanel.add(new JLabel("Previous Time 1"), BorderLayout.NORTH);		previousPanel.add(new JLabel("Previous Time 3"), BorderLayout.WEST);				previousPanel.add(input1Field, BorderLayout.EAST);		previousPanel.add(input2Field, BorderLayout.CENTER);		JButton submitButton = new JButton("Submit previous times");				submitButton.addActionListener(new ActionListener() {			public void actionPerformed(ActionEvent e){				String t = input1Field.getText();				int f = Integer.parseInt(t);				f++;				input1=f;				input1Field.setText(Integer.toString(input1));			}		});		previousPanel.add(submitButton, BorderLayout.SOUTH);				//Add the select and display panels to the main panel.		mainPanel.add(previousPanel);		mainPanel.add(afterPanel);				this.getContentPane().add(mainPanel);	}		public static void main(String[] args) {		HelloWorld frame = new HelloWorld();		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);		frame.pack();		frame.setVisible(true);	}   public void paint(Graphics g){       super.paint(g);       if(g instanceof Graphics2D) {           Graphics2D g2 = (Graphics2D) g;           g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);       }   }}