Java GUI won't returns error when attempting o
<p>Regarding the code below, I'm trying to get the <code>BOOKGUI</code> class to access the <code>BOOKSHELF</code> class and return the value from the method. </p>

<p><code>BOOKSHELF CLASS</code></p>

<pre><code>public int sizeOfBookshelf()
{
    return books.size();
}
</code></pre>

<p>by using something like the following in the <code>BOOKGUI</code> class</p>

<pre><code>JButton button3 = new JButton("Size of BookShelf");
        content.add(button3);
        button3.addActionListener(this);

 if (e.getActionCommand().equals("Size of BookShelf"))
            return books.size();   
</code></pre>

<p><br /><code>BOOKGUI CLASS</code></p>

<pre><code>import java.awt.FlowLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import javax.swing.*;

import java.awt.event.ActionListener; 
import java.util.ArrayList;

public class BookGUI extends JFrame implements ActionListener

{

    Book book = new Book("", "", 0, "", 0);
    String title  = "";
    String author  = "";
    int year = 0;
    String publisher  = "";
    double cost = 0;


    public BookShelf bookShelf = new BookShelf();
    public static final int WIDTH = 300;
    public static final int HEIGHT = 200;

    //Creates &amp; displays a window of the class FlowLayoutDemo
    public static void main(String[] args)
    {
        BookGUI gui = new BookGUI( );
        gui.setVisible(true);
    }

    public void setTitle(String title) //this is relevant
    {
        this.title = title;
    }

    public void setAuthor(String author) //this is relevant
    {
        this.author = author;
    }

    public void setYear(int year) //this is relevant
    {
        this.year = year;
    }
    public void setPublisher(String publisher) //this is relevant
    {
        this.publisher = publisher;
    }

    public void setCost(int cost) //this is relevant
    {
        this.cost = cost;
    }

    public BookGUI( )
    {

        setSize(WIDTH, HEIGHT);
        addWindowListener(new WindowDestroyer( ));
        setTitle("GUI Assignment");
        Container content = getContentPane( );

        content.setLayout(new FlowLayout());

        JButton button1 = new JButton("Title");
        content.add(button1);
        button1.addActionListener(this);
        //contentPane.add(button1);

        JButton button2 = new JButton("Author");
        content.add(button2);
        button2.addActionListener(this);

        JButton button3 = new JButton("Size of BookShelf");
        content.add(button3);
        button3.addActionListener(this);

        JButton button4 = new JButton("Add Book");
        content.add(button4);
        button4.addActionListener(this);     


    }


    public void actionPerformed(ActionEvent e)
    {

        if (e.getActionCommand().equals("Add Book"))
             //book = JOptionPane.showInputDialog("Add Book");
             //set up the book object with all the data passed in

        title = JOptionPane.showInputDialog("Title");
        author = JOptionPane.showInputDialog("Author");
        publisher = JOptionPane.showInputDialog("Publisher");
        book.setTitle(title);
        book.setAuthor(author);
        book.setPublisher(publisher);

            bookShelf.addBook(book);

        // set up each individual title, author, etc.  use joptionpane and mutators?
       //exception handling...
        // add the book to the bookShelf

        String message =  "The title of the book is :" + title + 
        "the Author of the Book is : " + author + " and it's published by " + publisher;
       //TAKE A LOOK AT THIS //JOptionPane.showMessageDialog(
                //null, " The sum is " + sum, "Results",
                //JOptionPane.PLAIN_MESSAGE );

        //System.exit( 0 );
        JOptionPane.showMessageDialog(null, message, "Book Details", JOptionPane.PLAIN_MESSAGE);

        //Container content = getContentPane( );
        if (e.getActionCommand().equals("Size of BookShelf"))
            return books.size();   

            //return sizeofBookshelf();
        //String message = "Number of books in shelf "+books.sizeOfBookshelf();
        //JOptionPane.showMessageDialog(null, message, "Book Shelf", JOptionPane.PLAIN_MESSAGE);

     //sizeOfBookshelf = JOptionPane.showInputDialog("Size");
     //sizeOfBookshelf = Integer.valueOf(JOptionPane.showInputDialog(null, "Enter size of bookshelf")); 

        //label2 = new JButton("Get Book Information");
        //content.add(label2);

        //JButton label3 = new JButton("Show Total Cost of Books");
        //content.add(label3);

    }
}
</code></pre>

<p><br /><code>BOOKSHELF CLASS</code></p>

<pre><code>import java.util.ArrayList;

/**
  * This class holds an ArrayList of Book.  There are methods for adding Book objects to the ArrayList,
  * calculating the total cost of all books in the ArrayList, determining how many Book objects are
  * in the ArrayList and determining the highest price paid for any one Book.
  *
  * @version 1.0
  */

public class BookShelf
{
    //create an ArrayList of Book.
    public ArrayList&lt;Book&gt; books;

    public BookShelf()
    {    
       books = new ArrayList&lt;Book&gt;();
    }

    /**
     * This method adds a Book object to the ArrayList
     * 
     * @param theBook The book object that will be added to the ArrayList
     * 
     */
    public void addBook(Book theBook)
    {
        books.add(theBook);
    }

    /**
     * This method returns the size of the ArrayList, that is, the number of books
     * that have been added to the ArrayList
     * 
     * @return The size of the ArrayList 
     */
    public int sizeOfBookshelf()
    {
        return books.size();
    }

    /**
     * This method calculates the cost of the book shelf, that is, it totals the 
     * cost of all the books in the ArrayList and returns it.
     * 
     * @return The cost of the book shelf
     */
    public double costOfBookshelf(){

        double total = 0;

        for(Book book : books) {
            total = total + book.getCost();
        }
        return total;
    }


    //create a method called highestPricePAid that will return the cost of the most expensive book in the ArrayList

    /**
     * This method finds the price of the most expensive book in the ArrayList and returns it.
     * 
     * @return The cost of the most expensive book on the book shelf
     */
    public double highestPricePaid(){

       double highestPrice = 0;

       for(Book book : books) {

            if((highestPrice == 0) || (highestPrice &lt; book.getCost())) { 
                highestPrice = book.getCost(); }
       }           
       return highestPrice;
    }             
}
</code></pre>

<p>But i'm getting errors in Eclipse.
Am i completely on the wrong track ?<br>
<br/><br/>Any assistance would be appreciated.  thanks</p>
