Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works


  • Please log in to reply




  • Member
  • PipPip
  • 29 posts
I have a library system and I have got this piece of code that will display the books into a JTable and when you click on one book it will print it in the console but I need to find out how to link it to my members class and display the book they loan out for each member can some one please :tazz: me

private void display() {
    data = new Vector();
    books = library.getBook().getBook();
    for (int i =0; i<books.size(); i++) {
      Book libraryBooks = (Book) books.get(i);
      Vector row = new Vector();
      row.add(new Double(libraryBooks.getAmount()));
      System.out.println("Testing Library Book Storage"+"\n"+libraryBooks);
    model = new DefaultTableModel(data, columns);

  void bookTable_mouseClicked(MouseEvent e) {
    //String isbn=null;
    //String publisher=null;
    //String author=null;
    //String title=null;
    //Double amount=null; //going to change to int

    int row = bookTable.getSelectedRow();
    TableColumnModel colModel = bookTable.getColumnModel();

    String isbn = (String)bookTable.getValueAt(row, 0);
    String publisher = (String)bookTable.getValueAt(row, 1);
    String author = (String)bookTable.getValueAt(row, 2);
    String title = (String)bookTable.getValueAt(row, 3);
    Double amount = (Double)bookTable.getValueAt(row, 4); //going to change to int

    /* ////////////////////////////////////////////////
    for(int col=0;col<colModel.getColumnCount();col++){
      Object value = bookTable.getValueAt(row, col);
        isbn = (String)value;
      else if(col==1){
        publisher = (String)value;
      else if(col==2){
        author = (String)value;
      else if(col==3){
        title = (String)value;
      else if(col==4){ 
        amount = (Double)value; //going to change to int

    //////////////////////////////////////////////// */

    System.out.println("ISBN: " + isbn + ", Publisher: " + publisher + ", Author: " + author + ", Title: " + title + " , Amount: " + amount);


I can send the whole program I have so far if it helps
  • 0





  • Topic Starter
  • Member
  • PipPip
  • 29 posts
no one on here can help then ;)

please :tazz:
  • 0

Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP