public Ticket getSelectedTicket() { int selectedRow = table.getSelectedRow(); if (selectedRow < 0) { return null; } return (Ticket) tableModel.getRowData(selectedRow); }
public List<Ticket> getSelectedTickets() { int[] selectedRows = table.getSelectedRows(); ArrayList<Ticket> tickets = new ArrayList<Ticket>(selectedRows.length); for (int i = 0; i < selectedRows.length; i++) { Ticket ticket = (Ticket) tableModel.getRowData(selectedRows[i]); tickets.add(ticket); } return tickets; }
public void addTicket(Ticket ticket) { tableModel.addItem(ticket); }
public void setTickets(List<Ticket> tickets) { tableModel.setRows(tickets); }