-
Swing help
ust 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
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("");
}
}
-
fix the error first , where is the method
public void submit()
{
System.out.println("submitted");
}
}
-
Similar Threads
-
By Darren Bell in forum Talk to the Editors
Replies: 2
Last Post: 09-20-2002, 10:32 AM
-
By JB in forum Talk to the Editors
Replies: 3
Last Post: 09-16-2002, 08:15 PM
-
By Jeremy Dean in forum Java
Replies: 0
Last Post: 08-14-2001, 08:00 AM
-
By Shaun Botha in forum Java
Replies: 5
Last Post: 06-25-2001, 09:19 PM
-
By Fabio Luis De Paoli in forum Java
Replies: 0
Last Post: 08-17-2000, 01:06 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks