protected JComponent initButtons()
    {
        JPanel q = new JPanel();
        q.setLayout(new BoxLayout(q, BoxLayout.Y_AXIS));
        
        myMessage = new JTextArea();
        myMessage.setEditable(false);
        q.add(myMessage);
        
        JPanel topRow = new JPanel();
        JPanel bottomRow = new JPanel();
        
        myAddCase = new JButton("Add");
        myAddCase.addActionListener(new ActionListener()
            {
                public void actionPerformed(ActionEvent e)
                {
                    addCase();
                }
            });
        myAddCase.setToolTipText("Add the current case to the list");
        myAddCase.setEnabled(false);
        topRow.add(myAddCase);
        
        myReplace = new JButton("Replace");
        myReplace.addActionListener(new ActionListener()
            {
                public void actionPerformed(ActionEvent e)
                {
                    replaceCase(myTable.getSelectedRow());
                }
            });
        myReplace.setToolTipText("Replace the selected case with the current case");
        myReplace.setEnabled(false);
        topRow.add(myReplace);
        
        myShowAll = new JButton("List");
        myShowAll.addActionListener(new ActionListener()
            {
                public void actionPerformed(ActionEvent e) 
                {
                    listAll();
                }
            });
        myShowAll.setEnabled(false);
        myShowAll.setToolTipText("List all possible cases");
        bottomRow.add(myShowAll);
        
        myShowCase = new JButton("Show");
        myShowCase.addActionListener(new ActionListener()
            {
                public void actionPerformed(ActionEvent e)
                {
                    showCase(myTable.getSelectedRow());
                }
            });
        myShowCase.setEnabled(false);
        myShowCase.setToolTipText("Display the selected case");
        topRow.add(myShowCase);
        
        myClearCase = new JButton("Delete");
        myClearCase.addActionListener(new ActionListener()
            {
                public void actionPerformed(ActionEvent e) 
                {
                    clearCase(myTable.getSelectedRow());
                }
            });
        myClearCase.setEnabled(false);
        myClearCase.setToolTipText("Delete the selected case");
        topRow.add(myClearCase);
        
        myClearAll = new JButton("Clear");
        myClearAll.addActionListener(new ActionListener()
            {
                public void actionPerformed(ActionEvent e) 
                {
                    clearAll();
                }
            });
        myClearAll.setToolTipText("Clear all cases");
        bottomRow.add(myClearAll);
        
        myDone = new JButton("Done?");
        myDone.addActionListener(new ActionListener()
            {
                public void actionPerformed(ActionEvent e)
                {
                    int numLeft = myLemma.numCasesTotal() - myCases.size();
                    if(numLeft == 1)
                        myMessage.setText("1 case left.");
                    else if(numLeft > 1)
                        myMessage.setText(numLeft + " cases left.");
                    else 
                    	myMessage.setText("All cases done.");
                }
            });
        myDone.setToolTipText("Check if all cases are done");
        bottomRow.add(myDone);
        
        /*
         * Enables and disables myShowCase and myClearCase depending on
         * whether there is a selection.
         */
        myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener()
            {
                public void valueChanged(ListSelectionEvent e) 
                {
                    if(e.getValueIsAdjusting())
                        return;
                    
                    ListSelectionModel lsm = (ListSelectionModel)e.getSource();
                    if(lsm.isSelectionEmpty())
                    {
                        myShowCase.setEnabled(false);
                        myClearCase.setEnabled(false);
                        myReplace.setEnabled(false);
                    }
                    else
                    {
                        myShowCase.setEnabled(true);
                        myClearCase.setEnabled(true);
                        myReplace.setEnabled(myAddCase.isEnabled());
                    }
                }
            });

        q.add(topRow);
        q.add(bottomRow);
        JScrollPane r = new JScrollPane(q);
        return r;
    }