Why do I get these errors? Im so lost...
F:\Java II\MenuReporter\RoseSarah\MenuSwing2.java:14: 'class' or 'interface' expected
private JTextField message;
^
F:\Java II\MenuReporter\RoseSarah\MenuSwing2.java:137: cannot resolve symbol
symbol : variable message
location: class MenuSwing2
message = new JTextField(30);
^
F:\Java II\MenuReporter\RoseSarah\MenuSwing2.java:138: cannot resolve symbol
symbol : variable message
location: class MenuSwing2
content.add(message, BorderLayout.CENTER);
^
F:\Java II\MenuReporter\RoseSarah\MenuSwing2.java:138: cannot resolve symbol
symbol : variable content
location: class MenuSwing2
content.add(message, BorderLayout.CENTER);
^
F:\Java II\MenuReporter\RoseSarah\MenuSwing2.java:145: cannot resolve symbol
symbol : variable message
location: class MenuSwing2
message.setText("Yummy");
^
5 errors
Tool completed with exit code 1
[CODE]
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
private JTextField message;
public class MenuSwing2 extends JFrame implements ActionListener
{
//declare variables for components we will need
private JPanel foodPanel;
private JButton food1;
private JButton food2;
private JButton food3;
private JButton food4;
private JButton food5;
private JButton food6;
private JButton food7;
private JButton food8;
private JPanel rankPanel;
private JButton rankBtn5;
private JButton rankBtn4;
private JButton rankBtn3;
private JButton rankBtn2;
private JButton rankBtn1;
private JPanel outputPanel;
private JLabel banner;
private JLabel enterEntree;
private JTextField entreeNum;
//variables to hold food names (until file input in phased in)
private String s1="Classic Nachos";
private String s2="Fajitas";
private String s3="Cajun Chicken";
private String s4="Cheeseburger Deluxe";
private String s5="Tuna Steak";
private String s6="Ribeye Steak";
private String s7="Baby Back Ribs";
private String s8="Fried Chicken";
public MenuSwing2() // constructor
{
setSize (WIDTH, HEIGHT);
addWindowListener(new WindowDestroyer());
Container contentPane = getContentPane();
JPanel buttonPanel = new JPanel();
JPanel buttonPanel1 = new JPanel();
buttonPanel.setLayout(new GridLayout(2,8));
buttonPanel1.setLayout(new GridLayout(1,5));
JButton food1 = new JButton ("Classic Nachos");
food1.setBackground (Color.RED);
food1.addActionListener(this);
buttonPanel.add(food1);
JButton food2 = new JButton ("Fajitas");
food2.setBackground (Color.RED);
food2.addActionListener(this);
buttonPanel.add(food2);
JButton food3 = new JButton ("Cajun Chicken");
food3.setBackground (Color.RED);
food3.addActionListener(this);
buttonPanel.add(food3);
JButton food4 = new JButton ("Cheeseburger Deluxe");
food4.setBackground (Color.RED);
food4.addActionListener(this);
buttonPanel.add(food4);
JButton food5 = new JButton ("Tuna Steak");
food5.setBackground (Color.RED);
food5.addActionListener(this);
buttonPanel.add(food5);
JButton food6 = new JButton ("Ribeye Steak");
food6.setBackground (Color.RED);
food6.addActionListener(this);
buttonPanel.add(food6);
JButton food7 = new JButton ("Babyback Ribs");
food7.setBackground (Color.RED);
food7.addActionListener(this);
buttonPanel.add(food7);
JButton food8 = new JButton ("Fried Chicken");
food8.setBackground (Color.RED);
food8.addActionListener(this);
buttonPanel.add(food8);
JButton rankBtn1 = new JButton ("Excellent");
rankBtn1.setBackground (Color.RED);
rankBtn1.addActionListener(this);
buttonPanel1.add(rankBtn1);
JButton rankBtn2 = new JButton ("Very Good");
rankBtn2.setBackground (Color.RED);
rankBtn2.addActionListener(this);
buttonPanel1.add(rankBtn2);
JButton rankBtn3 = new JButton ("Average");
rankBtn3.setBackground (Color.RED);
rankBtn3.addActionListener(this);
buttonPanel1.add(rankBtn3);
JButton rankBtn4 = new JButton ("Fair");
rankBtn4.setBackground (Color.RED);
rankBtn4.addActionListener(this);
buttonPanel1.add(rankBtn4);
JButton rankBtn5 = new JButton ("Poor");
rankBtn5.setBackground (Color.RED);
rankBtn5.addActionListener(this);
buttonPanel1.add(rankBtn5);
contentPane.add(buttonPanel, BorderLayout.NORTH );
contentPane.add(buttonPanel1, BorderLayout.SOUTH);
message = new JTextField(30);
content.add(message, BorderLayout.CENTER);
// refer to the "Steps for Advanced Swing programs
}
public void actionPerformed(ActionEvent e)
{
if (e.getActionCommand().equals("Classic Nachos"))
message.setText("Yummy");
// stub
// do not complete this method yet
}
public static void main(String[] args)
{
// inFile is named MenuList.txt
// open File
// read in data for each menu item
MenuSwing2 chilis = new MenuSwing2(); //instantiate a GUI Object
chilis.setBounds(200,200,650,300);
chilis.setBackground(Color.CYAN);
chilis.setTitle("Menu Grader!");
chilis.setVisible(true);
}
}
[/CODE