just stated learning Java. trying to create a java EmailFrame which will display a blank Submission Complete message.
but i keep getting error message when ever I try to compile the code.
error (Can not find symbol symbol method submit)
this is what my script looks like
Code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class EmailFrame extends JFrame
{
private InfoPanel infoPanel = new InfoPanel();
public EmailFrame()
{
super("Shared Listener Test");
setJMenuBar(createMenuBar());
getContentPane().add(infoPanel);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(190,150);
setLocation(300,300);
}
private JMenuBar createMenuBar()
{
JMenuBar menuBar = new JMenuBar();
JMenu menu;
JMenuItem item;
item = new JMenuItem("Exit");
item.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
System.exit(0);
}
});
return menuBar;
}
public static void main(String[] args)
{
JFrame f = new EmailFrame();
f.setVisible(true);
}
}
class InfoPanel extends JPanel
{
private JTextField firstname = new JTextField(10);
private JTextField lastname = new JTextField(10);
private JTextField email = new JTextField(15);
private JButton button = new JButton("Submit");
public InfoPanel()
{
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
submit();
}
});
setLayout(new GridLayout(4,2));
add(new JLabel("Firstname"));
add(firstname);
add(new JLabel("Lastname"));
add(lastname);
add(new JLabel("Email"));
add(email);
add(button);
}
public void clear()
{
firstname.setText("");
lastname.setText("");
email.setText("");
}
}