public StackFrame()
    {
        // first create the buttons and widgets to put on the frame

        pushButton = new JButton("Push Item");
        popButton = new JButton("Pop Item");
        peekButton = new JButton("Peek At Stack");
        showButton = new JButton("Show Stack");
        sizeButton = new JButton("Show Stack Size");
        spaceButton = new JButton("Show Stack Space");
        stackButton = new JButton("Switch Stacks");
        clearButton = new JButton("Clear Stack");

        field = new JTextField(50);
        area = new JTextArea(10,50);
        field.setText("Current stack: stackA");
        stackA = new StackAImpl<String>();
        stackL = new StackLImpl<String>();
        isStackA=true;

        buttonPanel1 = new JPanel();  // used to keep the buttons together
        buttonPanel2 = new JPanel();
        // 
        this.setTitle("Stack Testing");
        
        this.getContentPane().setLayout(new FlowLayout());
        this.getContentPane().add(buttonPanel1);
        this.getContentPane().add(buttonPanel2);
        this.getContentPane().add(field);
        this.getContentPane().add(area);
        
        buttonPanel1.add(pushButton);
        buttonPanel1.add(popButton);
        buttonPanel1.add(peekButton);
        buttonPanel1.add(showButton);
        
        buttonPanel2.add(sizeButton);
        buttonPanel2.add(spaceButton);
        buttonPanel2.add(stackButton);
        buttonPanel2.add(clearButton);

        area.setEditable(false); // its now UNchangeable
        
        
        /* action listener: push button */
        pushButton.addActionListener( new ActionListener()
        {
            public void actionPerformed (ActionEvent e)
            {
                doPush();
            }
            
        } );

        
        /* action listener: pop button */
        popButton.addActionListener(new ActionListener()
        {
            public void actionPerformed (ActionEvent e)
            {             
                String poppedItem = "";
                
                if(isStackA)
                {
                    poppedItem = stackA.pop();
                    area.setText("pop successful!\n" +
                        "Here's what was popped from stackA: " + poppedItem + "\n\n" +
                        "Here are the current contents of stackA:\n" + stackL); 
                }
                else
                {
                    poppedItem = stackL.pop();
                    area.setText("pop successful!\n" +
                        "Here's what was popped from stackL: " + poppedItem + "\n\n" +
                        "Here are the current contents of stackL:\n" + stackL);                  
                }               
                
            }
            
        } );
        
        
        /* action listener: peek button */
        peekButton.addActionListener(new ActionListener()
        {
            public void actionPerformed (ActionEvent e)
            {
                String peekItem = "";
                
                if(isStackA)
                {
                    peekItem = stackA.peek();
                    area.setText("Here's the item on the top of stackA: " + peekItem);
                }
                else
                {
                    peekItem = stackL.peek();
                    area.setText("Here's the item on the top of stackL: " + peekItem);
                }               
                
            }
            
        } );
        
        
        /* action listener: stack button */
        stackButton.addActionListener( new ActionListener()
        {
            public void actionPerformed (ActionEvent e)
            {
                isStackA = !isStackA;
                
                if(isStackA)
                {
                    field.setText("Current stack: stackA");
                    area.setText("Here are the current contents of stackA:\n" + stackA);
                }
                else
                {
                    field.setText("Current stack: stackL");
                    area.setText("Here are the current contents of stackL:\n" + stackL);
                }

            }
            
        } );
        
        /* action listener: show button */
        showButton.addActionListener( new ActionListener()
        {
            public void actionPerformed (ActionEvent e)
            {
                if(isStackA)
                    area.setText("Here are the current contents of stackA:\n" + stackA);
                
                else
                    area.setText("Here are the current contents of stackL:\n" + stackL);
            }
            
        } );

        
        /* action listener: size button */
        sizeButton.addActionListener( new ActionListener()
        {
            public void actionPerformed (ActionEvent e)
            {
                if(isStackA)
                    area.setText("Here's the current size of stackA:  " + stackA.size() +
                        " items");
                
                else
                    area.setText("Here's the current size of stackL:  " + stackL.size() +
                        " items");
            }
            
        } );
        
        
        /* action listener: space button */
        spaceButton.addActionListener( new ActionListener()
        {
            public void actionPerformed (ActionEvent e)
            {
                if(isStackA)
                {
                    if(!stackA.isFull())
                        area.setText("stackA has room for " + (5 - stackA.size()) +
                            " more items.");
                
                    else
                        area.setText("stackA is already full.");
                }
                
                else
                {
                    if(!stackL.isFull())
                        area.setText("stackL has room for " + (5 - stackL.size()) +
                            " more items.");
            
                    else
                        area.setText("stackL is already full.");
                }
            }
            
        } );
        
        
        /* action listener: clear button */
        clearButton.addActionListener( new ActionListener()
        {
            public void actionPerformed (ActionEvent e)
            {
                if(isStackA)
                {
                    stackA.clear();
                    area.setText("clear successful!\n" + stackA);
                }
                else
                {
                    stackL.clear();
                    area.setText("clear successful!\n" + stackL);
                }
            }
            
        } );


    }// end of constructor