New to Java, cant figure out why im getting this error code.
import java.awt.*;
import javax.swing.*;
import java.text.*;
import java.awt.event.*;
public class RetailSales extends JFrame
{
/* --------------------------------- declarations */
// color objects
Color black = new Color(0, 0, 0);
Color white = new Color(255, 255, 255);
// number formats
DecimalFormat currency; // declaration statement
// components
JLabel numberOfItemsJLabel;
JTextField numberOfItemsJTextField;
JLabel priceOfItemsJLabel;
JTextField priceOfItemsJTextField;
JLabel subTotalJLabel;
JTextField subTotalJTextField;
JLabel salesTaxJLabel;
JTextField salesTaxJTextField;
JLabel totalAmountJLabel;
JTextField totalAmountJTextField;
JButton enterJButton;
JButton clearJButton;
// variables - constants
int numberOfItems;
double priceOfItems;
double subTotal;
double totalAmount;
double salesTax;
public RetailSales()
{
createUserInterface();
}
public void createUserInterface()
{
Container contentPane = getContentPane();
contentPane.setBackground(white);
contentPane.setLayout(null);
//initialize components
currency = new DecimalFormat("$0.00");
numberOfItemsJLabel = new JLabel();
numberOfItemsJLabel.setBounds(75, 50, 100, 20);
numberOfItemsJLabel.setFont(new Font("Default", Font.PLAIN, 12));
numberOfItemsJLabel.setText("Number Of Items:");
numberOfItemsJLabel.setForeground(black);
numberOfItemsJLabel.setHorizontalAlignment(JLabel. CENTER);
contentPane.add(numberOfItemsJLabel);
numberOfItemsJTextField = new JTextField();
numberOfItemsJTextField.setBounds(225, 50, 50, 20);
numberOfItemsJTextField.setFont(new Font("Default", Font.PLAIN, 12));
numberOfItemsJTextField.setHorizontalAlignment(JTe xtField.CENTER);
numberOfItemsJTextField.setForeground(black);
numberOfItemsJTextField.setBackground(white);
numberOfItemsJTextField.setEditable(true);
contentPane.add(numberOfItemsJTextField);
priceOfItemsJLabel = new JLabel();
priceOfItemsJLabel.setBounds(75, 80, 100, 20);
priceOfItemsJLabel.setFont(new Font("Default", Font.PLAIN, 12));
priceOfItemsJLabel.setText("Price Per Item:");
priceOfItemsJLabel.setForeground(black);
priceOfItemsJLabel.setHorizontalAlignment(JLabel.L EFT);
contentPane.add(priceOfItemsJLabel);
priceOfItemsJTextField = new JTextField();
priceOfItemsJTextField.setBounds(225, 80, 50, 20);
priceOfItemsJTextField.setFont(new Font("Default", Font.PLAIN, 12));
priceOfItemsJTextField.setHorizontalAlignment(JTex tField.CENTER);
priceOfItemsJTextField.setForeground(black);
priceOfItemsJTextField.setBackground(white);
priceOfItemsJTextField.setEditable(true);
contentPane.add(priceOfItemsJTextField);
subTotalJLabel = new JLabel();
subTotalJLabel.setBounds(75, 130, 100, 20);
subTotalJLabel.setFont(new Font("Default", Font.PLAIN, 12));
subTotalJLabel.setText("Result Number:");
subTotalJLabel.setForeground(black);
subTotalJLabel.setHorizontalAlignment(JLabel.LEFT) ;
contentPane.add(subTotalJLabel);
subTotalJTextField = new JTextField();
subTotalJTextField.setBounds(225, 130, 50, 20);
subTotalJTextField.setFont(new Font("Default", Font.PLAIN, 12));
subTotalJTextField.setHorizontalAlignment(JTextFie ld.CENTER);
subTotalJTextField.setForeground(black);
subTotalJTextField.setBackground(white);
subTotalJTextField.setEditable(false);
contentPane.add(subTotalJTextField);
salesTaxJLabel = new JLabel();
salesTaxJLabel.setBounds(75, 160, 100, 20);
salesTaxJLabel.setFont(new Font("Default", Font.PLAIN, 12));
salesTaxJLabel.setText("Sales Tax:");
salesTaxJLabel.setForeground(black);
salesTaxJLabel.setHorizontalAlignment(JLabel.LEFT) ;
contentPane.add(salesTaxJLabel);
salesTaxJTextField = new JTextField();
salesTaxJTextField.setBounds(225, 160, 50, 20);
salesTaxJTextField.setFont(new Font("Default", Font.PLAIN, 12));
salesTaxJTextField.setHorizontalAlignment(JTextFie ld.CENTER);
salesTaxJTextField.setForeground(black);
salesTaxJTextField.setBackground(white);
salesTaxJTextField.setEditable(false);
contentPane.add(salesTaxJTextField);
totalAmountJLabel = new JLabel();
totalAmountJLabel.setBounds(75, 190, 100, 20);
totalAmountJLabel.setFont(new Font("Default", Font.PLAIN, 12));
totalAmountJLabel.setText("Total Amount:");
totalAmountJLabel.setForeground(black);
totalAmountJLabel.setHorizontalAlignment(JLabel.LE FT);
contentPane.add(totalAmountJLabel);
totalAmountJTextField = new JTextField();
totalAmountJTextField.setBounds(225, 190, 50, 20);
totalAmountJTextField.setFont(new Font("Default", Font.PLAIN, 12));
totalAmountJTextField.setHorizontalAlignment(JText Field.CENTER);
totalAmountJTextField.setForeground(black);
totalAmountJTextField.setBackground(white);
totalAmountJTextField.setEditable(false);
contentPane.add(totalAmountJTextField);
enterJButton = new JButton();
enterJButton.setBounds(150, 300, 50, 20);
enterJButton.setFont(new Font("Default", Font.PLAIN, 12));
enterJButton.setText("Enter");
enterJButton.setForeground(black);
enterJButton.setBackground(white);
contentPane.add(enterJButton);
enterJButton.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
enterJButtonActionPerformed(event);
}
}
);
// set properties of application’s window
setTitle("RetailSales");
setSize(400, 400);
setVisible(true);
}
// main method
public static void main(String[] args)
{
RetailSales application = new RetailSales();
application.setDefaultCloseOperation(JFrame.EXIT_O N_CLOSE);
}
}
// when i compile i get this error message.
RetailSales.java:171: cannot find symbol
symbol: method enterJButtonActionPerformed(java.awt.event.ActionE vent)
enterJButtonActionPerformed(event);
^
This is my 3rd assignment in an online college course, I haven't even gotten to hard part yet of writing the main method and the assignment is due in 2 days. I dont think anything has ever made me so frustrated as this programing stuff gets me.