private void RodytiKnyguRinkinius() { neregKnyguZona.setText(""); for (Book a : rg.neregKnygos) neregKnyguZona.append(a.toString() + "\n"); regKnyguZona.setText(""); for (Map.Entry<String, Book> me : rg.regKnygos.entrySet()) regKnyguZona.append(String.format("%8s=%s\n", me.getKey(), me.getValue())); tfNeregSKaitytojųKiekis.setText(Integer.toString(rg.neregKnygos.size())); tfRegSKaitytojųKiekis.setText(Integer.toString(rg.regKnygos.size())); }
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); } }
@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(); } }