import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import java.text.DecimalFormat;
import java.io.*;
import javax.swing.JOptionPane;
import java.math.*;
public class last_try implements ActionListener
{
// put variable declarations here (i.e. code below)
JFrame f;
JButton button1;
JButton button2;
// etc. for other variables
public last_try() // new constructor. No longer have "static" limitiations
{
// code here that uses the variables declared above
// see code below
f = new JFrame("What would you like to do");
f.setSize(400, 150);
// more code to set up GUI
button1 = new JButton("Button 1");
button2 = new JButton("Button 2");
button3 = new JButton("Button 3");
button1.addActionListener(this); // add action listeners here
button2.addActionListener(this);
// more code
// need more code to use the line below, so commented out.
// Are you sure you really want it?
// f.addWindowListener(new ExitListener());
f.setVisible(true);
}
public static void main(String[] args)
{
last_try last = new last_try();
}
public void popUp()
{
JFrame frame = new JFrame("aName");
frame.setSize(500, 500);
frame.setVisible(true);
}
public void actionPerformed(ActionEvent event)
{
System.out.println("In actionPerformed");
if (event.getSource() == button1) // no quotes here
{
JOptionPane.showMessageDialog(null, "Your entry was not in the proper format.");
}
}
}