users@glassfish.java.net

I m new to java, i m trying to get this to work....

From: <glassfish_at_javadesktop.org>
Date: Fri, 17 Apr 2009 00:27:45 PDT

i m trying to get this to work...i need help.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;




public class BookStoreProgram99 extends JFrame implements ActionListener {
        
        //variables Book info
        private JLabel HeadingLabel;
        private JLabel FilerLabel;
        private JLabel NameLabel;
        private JLabel ISBNLabel;
        private JLabel PriceLabel;
        private JLabel Author1Label;
        private JLabel Author2Label;
        private JLabel Author3Label;
        private JLabel Author4Label;
        private JLabel QuantityLabel;
        private JLabel PublisherLabel;
        private JLabel YearOfPublicationLabel;
        private JTextField NameText;
        private JTextField IsbnText;
        private JTextField PriceText;
        private JTextField Author1Text;
        private JTextField Author2Text;
        private JTextField Author3Text;
        private JTextField Author4Text;
        private JTextField QuantityText;
        private JTextField PublisherText;
        private JTextField YearOfPublicationText;
        private JButton SubmitB, ClearB ;
        
        // variables Member info
        private JLabel HeadingLabelM;
        private JLabel FilerLabelM ;
        private JLabel MemberNameM;
        private JLabel MemberIdM;
        private JLabel NumberBookbought;
        private JLabel AmountSpent;
        private JLabel MemberShip;
        private JTextField NameTextM;
        private JTextField MemberIdText;
        private JTextField NumberBookboughtText;
        private JTextField AmountSpentText;
        private JTextField MemberShipText;
        private JButton SubmitBM, ClearBM ;
        private Container pane ;
        private JMenuItem BookAction;
        private JMenuItem MemberAction;
        
        
        
        
        
        
        
        
        public BookStoreProgram99() {
                                super("Book Store!");
                                //setTitle("Book Store");
                        setSize(750, 850);

                        // Creates a menubar for a JFrame
                        JMenuBar menuBar = new JMenuBar();

                        // Add the menubar to the frame
                        setJMenuBar(menuBar);

                        // Define and add two drop down menu to the menubar
                
                        JMenu fileMenu = new JMenu("File");
                                JMenu searchMenu = new JMenu("Search");
                                menuBar.add(fileMenu);
                                menuBar.add(searchMenu);
                                
                                // Create and add simple menu item to one of the drop down menu
                                
                                 JMenuItem BookAction = new JMenuItem("Add New Book");
                                 JMenuItem MemberAction = new JMenuItem("Add New Member");
                                 JMenuItem SearchbookAction = new JMenuItem("Search for Book");
                                 JMenuItem SearchmemberAction = new JMenuItem("Search for Member");
                                
                                // add menu items to the right menu.
                                
                                  fileMenu.add(BookAction);
                                  fileMenu.add(MemberAction);
                                  searchMenu.add(SearchbookAction);
                                  searchMenu.add(SearchbookAction);
                                
                                //ntainer pane = getContentPane();
                                        
                        // pane.setLayout(new GridLayout(12,2));
                                
                                  
                                
                                
                                BookAction.addActionListener(this);
                                MemberAction.addActionListener(this);
                                
                                setVisible(true);
                                setDefaultCloseOperation(EXIT_ON_CLOSE);
                           }
                                public void actionPerformed(ActionEvent e)
                                {
                                        
                                        JMenuItem mItem = (JMenuItem) e.getSource();
                                        
                                        //Container pane = getContentPane();
                                        
                                        
                                        
                                        
                                        
                                        if (mItem == BookAction)
                                        
                                                                        {
                                                        
                                                                HeadingLabel = new JLabel("Enter Info.", SwingConstants.CENTER);
                                                                FilerLabel = new JLabel("Filer Label",SwingConstants.CENTER);
                                                                NameLabel = new JLabel("Customer Name:",SwingConstants.CENTER);
                                                                ISBNLabel = new JLabel("ISBN :",SwingConstants.CENTER);
                                                                PriceLabel = new JLabel("Price in Dollars:",SwingConstants.CENTER);
                                                                Author1Label = new JLabel("Author 1 :", SwingConstants.CENTER);
                                                                Author2Label = new JLabel("Author 2 :", SwingConstants.CENTER);
                                                                Author3Label = new JLabel("Author 3 :", SwingConstants.CENTER);
                                                                Author4Label = new JLabel("Author 4 :", SwingConstants.CENTER);
                                                                QuantityLabel = new JLabel("Quantity :", SwingConstants.CENTER);
                                                                PublisherLabel = new JLabel("Publisher:", SwingConstants.CENTER);
                                                                YearOfPublicationLabel = new JLabel("Year of Publication:", SwingConstants.CENTER);
                                                                NameText = new JTextField("");
                                                                IsbnText = new JTextField("");
                                                                PriceText = new JTextField("");
                                                                Author1Text = new JTextField("");
                                                                Author2Text = new JTextField("");
                                                                Author3Text = new JTextField("");
                                                                Author4Text = new JTextField("");
                                                                QuantityText = new JTextField("");
                                                                PublisherText = new JTextField("");
                                                                YearOfPublicationText = new JTextField("");
                                                                SubmitB = new JButton("Submit");
                                                                ClearB = new JButton("Clear");
                                                                
                                                                        
                                                                
                                                                pane.add(HeadingLabel);
                                                                pane.add(FilerLabel);
                                                                pane.add(NameLabel);
                                                                pane.add(NameText);
                                                                pane.add(ISBNLabel);
                                                                pane.add(IsbnText);
                                                                pane.add(PriceLabel);
                                                                pane.add(PriceText);
                                                                pane.add(Author1Label);
                                                                pane.add(Author1Text);
                                                                pane.add(Author2Label);
                                                                pane.add(Author2Text);
                                                                pane.add(Author3Label);
                                                                pane.add(Author3Text);
                                                                pane.add(Author4Label);
                                                                pane.add(Author4Text);
                                                                pane.add(QuantityLabel);
                                                                pane.add(QuantityText);
                                                                pane.add(PublisherLabel);
                                                                pane.add(PublisherText);
                                                                pane.add(YearOfPublicationLabel);
                                                                pane.add(YearOfPublicationText);
                                                                pane.add(SubmitB);
                                                                pane.add(ClearB);
                                                                
                                                                Container pane = getContentPane();
                                                                pane.setLayout(new GridLayout(12,2));
                                                                setVisible(true);
                                                                setDefaultCloseOperation(EXIT_ON_CLOSE);
                                                            }
                                                
                                        
                                                                else if (mItem == MemberAction)
                                                                
                                                                {
                                                                HeadingLabelM = new JLabel("Enter Customer Info.");
                                                                FilerLabelM = new JLabel("Filer Label");
                                                                MemberNameM = new JLabel("Customer Name");
                                                                MemberIdM = new JLabel("Member ID");
                                                                NumberBookbought = new JLabel("Number of Books Bought.");
                                                                AmountSpent = new JLabel("Amount Spent");
                                                                MemberShip = new JLabel("Membership:");
                                                                NameTextM = new JTextField("");
                                                                MemberIdText = new JTextField("");
                                                                NumberBookboughtText = new JTextField("");
                                                                AmountSpentText = new JTextField("");
                                                                MemberShipText = new JTextField("");
                                                                SubmitBM = new JButton("Submit");
                                                                ClearBM = new JButton("Clear");
                                                                
                                                                pane.add(HeadingLabelM);
                                                                pane.add(FilerLabelM);
                                                                pane.add(MemberNameM);
                                                                pane.add(MemberIdM);
                                                                pane.add(NumberBookbought);
                                                                pane.add(AmountSpentText);
                                                                pane.add(MemberShipText);
                                                                pane.add(NameText);
                                                                pane.add(MemberIdText);
                                                                pane.add(NumberBookboughtText);
                                                                pane.add(AmountSpentText);
                                                                pane.add(MemberShipText);
                                                                pane.add(SubmitBM);
                                                                pane.add(ClearBM);
                                                                
                                                                
                                                                
                                                                Container pane = getContentPane();
                                                                pane.setLayout(new GridLayout(12,2));
                                                                        
                                                                setVisible(true);
                                                                setDefaultCloseOperation(EXIT_ON_CLOSE);
                                                                
                                                        }
                                                        
                                                
                                                
                                                
                        }
                                                
                                                
                                                                
     public static void main (String[] args)
                        {
                
                                BookStoreProgram99 StoreP = new BookStoreProgram99();
                                
                                   StoreP.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                               StoreP.setVisible(true);
                        }
                                                                                                    
                                                                
                                                                
                                                                
                                                                   
                                                                

}
[Message sent by forum member 'zamouri' (zamouri)]

http://forums.java.net/jive/thread.jspa?messageID=342530