public void getData() { for (int i = model.getRowCount() - 1; i >= 0; i--) { model.removeRow(i); } ArrayList<Book> list = bm.bookAllData(); for (Book book : list) { String[] data = {String.valueOf(book.getNo()), book.getTitle(), book.getAuthor()}; model.addRow(data); } }
public void getFindData() { for (int i = model.getRowCount() - 1; i >= 0; i--) { model.removeRow(i); } String pub = box.getSelectedItem().toString(); ArrayList<Book> list = bm.bookFindData(pub); tf.setText(pub); for (Book book : list) { String[] data = {String.valueOf(book.getNo()), book.getTitle(), book.getAuthor()}; model.addRow(data); } }