All pastes #2760 Raw Edit

CalculatorMain

public java v1 · immutable
#2760 ·published 2004-12-07 15:57 UTC
rendered paste body
package uk.co.peteski.www;import javax.swing.*;import java.awt.*;import java.awt.event.ActionListener;import java.awt.event.ActionEvent;/** * Created by IntelliJ IDEA. * User: peteski * Date: 02-Dec-2004 * Time: 17:06:07 * To change this template use File | Settings | File Templates. */public class CalculatorMain extends ExpressionParser implements ActionListener{  // teeny tiny GUI  JTextField text;  JButton okButton;  public CalculatorMain()  {    super("Expression Calculator");    text = new JTextField("");    okButton = new JButton("Ok");    // handle when we click the button    okButton.addActionListener(this);    // set the frame up.    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);    getContentPane().setLayout(new BorderLayout());    // add the components to the frame.    getContentPane().add(text, BorderLayout.NORTH);    getContentPane().add(okButton, BorderLayout.SOUTH);    pack();    show();  }  public void actionPerformed(ActionEvent e)  {    // fire the methods for parsing the text field string.    parseString(this.text.getText());  }  public static void main(String[] args)  {    new CalculatorMain();  }}