Example #1
0
 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);
   }
 }
Example #2
0
 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);
   }
 }
Example #3
0
 @Override
 public void mouseClicked(MouseEvent e) {
   // TODO Auto-generated method stub
   if (e.getSource() == table) {
     if (e.getClickCount() == 2) // 더블클릭
     {
       int row = table.getSelectedRow();
       String no = model.getValueAt(row, 0).toString();
       bp.setPoster(Integer.parseInt(no));
       bp.repaint();
       Book book = bm.bookDetail(Integer.parseInt(no));
       la1.setText("번호:" + no);
       la2.setText("제목:" + book.getTitle());
       la3.setText("저자:" + book.getAuthor());
       la4.setText("출판사:" + book.getPublisher());
       la5.setText("가격:" + book.getPrice());
     }
   } else if (e.getSource() == b) {
     getData();
   }
 }