Swing help


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Swing help

  1. #1
    Join Date
    Jun 2006
    Posts
    6

    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("");
    }
    }

  2. #2
    Join Date
    Apr 2006
    Posts
    28
    fix the error first , where is the method
    public void submit()
    {
    System.out.println("submitted");
    }
    }

  3. #3
    Join Date
    Jun 2006
    Posts
    6
    thanks

Similar Threads

  1. Swing is dead, long live SWT
    By Darren Bell in forum Talk to the Editors
    Replies: 2
    Last Post: 09-20-2002, 11:32 AM
  2. Replies: 3
    Last Post: 09-16-2002, 09:15 PM
  3. Enough with the SWING problems :)
    By Jeremy Dean in forum Java
    Replies: 0
    Last Post: 08-14-2001, 09:00 AM
  4. Using Swing with JSP
    By Shaun Botha in forum Java
    Replies: 5
    Last Post: 06-25-2001, 10:19 PM
  5. VisualCafe3Pro and Swing 1.1.1?
    By Fabio Luis De Paoli in forum Java
    Replies: 0
    Last Post: 08-17-2000, 02: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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center