Hi i have a teensy problem that i need help with, as i mentioned earlier in some previous thread (can't remember when!) i'm creatin an applet based tutorial. It's nearly finshed thank god except for the last applet i seem to be getting an error that i can't fix. heres the code below;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class textArea extends JApplet
implements ActionListener
{
public static final int LINES = 10;
public static final int CHAR_PER_LINE = 40;
private JTextArea theText;
private String memo1 = ("No Memo 1");
public void init()
{
Container getcontentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.setBackground(Color.BLUE);
JPanel buttonPanel = new JPanel();
buttonPanel.setBackground(Color.LIGHT_GRAY);
buttonPanel.setLayout(new FlowLayout());
JButton memo1Button = new JButton("save a memo");
memo1Button.addActionListener(this);
buttonPanel.add(memo1Button);
JButton clearButton = new JButton("clear name");
clearButton.addActionListener(this);
buttonPanel.add(clearButton);
JButton memo1Button2 = new JButton("get the memo");
memo1Button2.addActionListener(this);
buttonPanel.add(memo1Button2);
contentPane.add(buttonPanel, BorderLayout.NORTH);
JPanel textPanel = new JPanel();
textPanel.setBackground(Color.BLUE);
theText = new JTextArea(LINES, CHAR_PER_LINE);
theText.setBackground(Color.WHITE);
textPanel.add(theText);
contentPane.add(textPanel, BorderLayout.CENTER);
}
public void actionPerformed(ActionEvent e)
{
Container contentPane = getContentPane();
String actionCommand = e.getActionCommand();
if (actionCommand.equals("save a memo"))
memo1Button = theText.getText();
else if (actionCommand.equals("get the memo"))
memo1Button2 = theText.setText(memo1Button2);
else if (actionCommand.equals("clear name"))
clearButton = theText.setText("");
else theText.setText("error in interface");
}
}
the error i get is cannot find symbol variable contentPane, i dn't get it because evry applet i have dne so far uses the exact same coding and i've had no such problem, plese could anyone with the foggiest give me any tips, it will be much much appreciated, thanks!