private void limparTabela() { DefaultTableModel modelo = (DefaultTableModel) this.tbCargos.getModel(); int numLinhas = tbCargos.getRowCount(); for (int i = 0; i < numLinhas; i++) { modelo.removeRow(0); } }
/** Creates new form SessionLog */ public SessionLog() { initComponents(); try { Connection con = DBConnection.getConnection(); String query = "select * from user_session where user_id=?"; PreparedStatement psmt = con.prepareStatement(query); psmt.setString(1, "ababab"); ResultSet rs = psmt.executeQuery(); ResultSetMetaData rsmd; rsmd = rs.getMetaData(); Vector column = new Vector(); int count = rsmd.getColumnCount(); DefaultTableModel dtm = new DefaultTableModel(); for (int i = 1; i <= count; i++) { column.addElement(rsmd.getColumnName(i)); } dtm.setColumnIdentifiers(column); while (rs.next()) { Vector row = new Vector(); for (int i = 1; i <= count; i++) { row.addElement(rs.getString(i)); } dtm.addRow(row); } jTable1.setModel(dtm); } catch (Exception ex) { ex.printStackTrace(); } }
private void makeGUI() { this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // HashMap with some data. HashMap<String, String> map = new HashMap<String, String>(); map.put("key1", "value1"); map.put("key2", "value2"); // Create a DefaultTableModel, which will be used as the // model for the JTable. DefaultTableModel model = new DefaultTableModel(); // Populate the model with data from HashMap. model.setColumnIdentifiers(new String[] {"key", "value"}); for (String key : map.keySet()) model.addRow(new Object[] {key, map.get(key)}); // Make a JTable, using the DefaultTableModel we just made // as its model. JTable table = new JTable(model); this.getContentPane().add(table); this.setSize(200, 200); this.setLocation(200, 200); this.validate(); this.setVisible(true); }
private void criaJTable() { tabela = new JTable(modelo); modelo.addColumn("Código"); modelo.addColumn("Nome"); preencherTabela(); }
public void changeTaskData(TasksResponse tResponse) { DefaultTableModel dtm = (DefaultTableModel) tasksTable.getModel(); if (dtm.getRowCount() > 1) { dtm.setRowCount(0); } if (tResponse != null) { for (Task t : tResponse.getList()) { Object o[] = { false, t.getId(), t.getName(), t.getDescription(), t.getAllowedApplications().toString(), t.getRestrictedApplications().toString(), t.getStartDateTime(), t.getEndDateTime(), t.getNotificationType().toString() }; dtm.addRow(o); } } }
/** Method edit employee on database and edit on employee table */ private void editEmp() { parent.doBlur(); // Get Id employee selected String empID = view.getTblEmp().getValueAt(view.getTblEmp().getSelectedRow(), 0).toString(); // Get employee from database Employee emp = AccessEmp.getInstance().getEmpInfo(new Integer(empID)); // Create instance of Employee edit dialog and display it editEmp = new EditEmployeeController(new EditEmployeeDialog(parent.getView()), emp); editEmp.getView().setVisible(true); // Update data on database if (editEmp.getEmp() != null) { if (AccessEmp.getInstance().editEmp(editEmp.getEmp())) { JOptionPane.showMessageDialog( view, Messages.getString("EmployeeController.14"), // $NON-NLS-1$ Messages.getString("EmployeeController.15"), JOptionPane.INFORMATION_MESSAGE); // Remove old data on table model empModel.removeRow(view.getTblEmp().getSelectedRow()); // Add new row empModel.addRow(emp.toVector()); } else { JOptionPane.showMessageDialog( view, Messages.getString("EmployeeController.16") // $NON-NLS-1$ + Messages.getString("EmployeeController.17"), Messages.getString("EmployeeController.18"), // $NON-NLS-1$ JOptionPane.ERROR_MESSAGE); } } parent.doBlur(); // Set selection to employee book view.getTblEmp().changeSelection(view.getTblEmp().getRowCount() - 1, 0, false, false); }
private void populateTableUserBets() { List<Bet> btList = this.system.getSystemBets().getAllClosedBetsOfUser(usr.getUsername()); DefaultTableModel model = (DefaultTableModel) tbMyBets.getModel(); Game gm; Sport sport; int[] arr = new int[2]; String str; for (Bet bt : btList) { gm = system.getSystemGames().getGameByID(bt.getFiGame()); if (bt.getBet() == 1) { str = system.getSystemGames().getNameTeamByID(gm.getTeam1(), bt.getFiGame()); } else if (bt.getBet() == 0) { str = "DRAW"; } else { str = system.getSystemGames().getNameTeamByID(gm.getTeam2(), bt.getFiGame()); } sport = this.system.getSystemGames().getSportById(gm.getFiSport()); model.addRow( new Object[] { myBetsRowCount + 1, sport.getName(), str, bt.getOdd(), bt.getValue(), bt.getDate(), bt.getOdd() * bt.getValue() }); arr[0] = bt.getFiGame(); arr[1] = sport.getId(); myBetsRowCount++; } }
private void removeButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_removeButtonActionPerformed if (outputTable.getSelectedRow() != -1) { DefaultTableModel model = (DefaultTableModel) this.outputTable.getModel(); model.removeRow(outputTable.getSelectedRow()); } } // GEN-LAST:event_removeButtonActionPerformed
public static void showTable(ArrayList<StartinfoVO> startinfoVO) { int i = 0; for (StartinfoVO sinvo : startinfoVO) { tableModel.setValueAt(sinvo.getName(), i, 0); tableModel.setValueAt(sinvo.getAccount(), i, 1); tableModel.setValueAt(sinvo.getOrganization(), i, 2); tableModel.setValueAt(sinvo.getStaff(), i, 3); tableModel.setValueAt(sinvo.getVehicle(), i, 4); tableModel.setValueAt(sinvo.getStore(), i, 5); i++; if (i >= table.getRowCount()) { String[] rowstr = {"", "", "", "", "", ""}; tableModel.addRow(rowstr); } } while (i < table.getRowCount()) { tableModel.setValueAt("", i, 0); tableModel.setValueAt("", i, 1); tableModel.setValueAt("", i, 2); tableModel.setValueAt("", i, 3); tableModel.setValueAt("", i, 4); tableModel.setValueAt("", i, 5); i++; } }
@Override public void onCommand(String command) { String[] parts = command.split(" "); if (parts[0].equalsIgnoreCase("blockid") && parts.length == 2 && StringTools.isInteger(parts[1])) { synchronized (lock) { blockID = Integer.parseInt(parts[1]); JTable list = ui.getList(); DefaultTableModel model = (DefaultTableModel) list.getModel(); Vector<?> dataVector = model.getDataVector(); dataVector.clear(); model.fireTableDataChanged(); displayText(ChatColor.GRAY + "Block ID for searching is now " + ChatColor.GOLD + blockID); } } else if (parts[0].equalsIgnoreCase("blockradius") && parts.length == 2 && StringTools.isInteger(parts[1])) { synchronized (lock) { radius = Integer.parseInt(parts[1]); displayText( ChatColor.GRAY + "Block radius for searching is now " + ChatColor.GOLD + radius); } } }
public void addValueToRow(BookService bookService, int row) { model.setValueAt(bookService.getId(), row, 0); model.setValueAt(bookService.getService(), row, 1); model.setValueAt(bookService.getDate(), row, 2); model.setValueAt(bookService.getStaff(), row, 3); model.setValueAt(bookService.getNotation(), row, 4); }
/** * Fühlt die Tabelle mit den Daten von MediaList * * @param mediaList */ private void setColumnData(MediaList mediaList) { ResourceBundle bundle = ResourceBundle.getBundle(MuViBee.mainBundlePath); String[] title = new String[mediaList.getList().size()]; String[] mediaSpecial = new String[mediaList.getList().size()]; String[] genre = new String[mediaList.getList().size()]; String[] location = new String[mediaList.getList().size()]; String[] year = new String[mediaList.getList().size()]; String special = "n/a"; int i = 0; for (Media m : mediaList.getList()) { if (m instanceof Book) { mediaSpecial[i] = ((Book) m).getAuthor(); special = bundle.getString("authorLabel"); } else if (m instanceof Music) { mediaSpecial[i] = ((Music) m).getInterpreter(); special = bundle.getString("artistLabel"); } else if (m instanceof Video) { mediaSpecial[i] = ((Video) m).getActors(); special = bundle.getString("actorsLabel"); } title[i] = m.getTitle(); genre[i] = m.getGenre(); year[i] = (m.getReleaseYear() != 0) ? "" + m.getReleaseYear() : ""; location[i] = m.getLocation(); i++; } dtm.addColumn(bundle.getString("titleLabel"), title); dtm.addColumn(special, mediaSpecial); dtm.addColumn(bundle.getString("genreLabel"), genre); dtm.addColumn(bundle.getString("releaseYearLabel"), year); dtm.addColumn(bundle.getString("locationLabel"), location); }
public void setTablaPrincipal(java.util.List val) { DefaultTableModel modelo = ((DefaultTableModel) this.tablaPrincipal.getModel()); for (int i = 0; i < val.size(); i++) { modelo.addRow(((java.util.ArrayList) val.get(i)).toArray()); } this.calculaSumas(); }
public void showtblReport() { DefaultTableModel model = (DefaultTableModel) tblReport.getModel(); OrdersDAO cd = new OrdersDAO(); ResultSet rs = cd.reportDate(); try { while (rs.next()) { model.addRow( new Object[] { rs.getInt("id_cus"), rs.getString("name_cus"), rs.getDate("date_ship"), rs.getDouble("tongtien") }); } } catch (SQLException ex) { System.out.println(ex); } tblReport.setModel(model); int row = tblReport.getRowCount(); double sum = 0; for (int i = 0; i < row; i++) { sum += Double.parseDouble(model.getValueAt(i, 3).toString()); } txtDoanhThu.setText(String.valueOf(sum)); }
public static void llenarTablaOT(JTable tabla, ResultSet resultadoMostrarOT) throws SQLException { tabla.removeAll(); System.out.println("INICIO LLENADO TABLA"); int cantidadColumnas = resultadoMostrarOT.getMetaData().getColumnCount(); DefaultTableModel modelo = new DefaultTableModel() { public boolean isCellEditable(int x, int y) { return false; // Disallow the editing of any cell } }; modelo.setColumnCount(cantidadColumnas); ArrayList cabeceras = new ArrayList(); for (int z = 0; z < cantidadColumnas; z++) { // Esto imprime el nombre de las columnas cabeceras.add(resultadoMostrarOT.getMetaData().getColumnName(z + 1)); } modelo.setColumnIdentifiers(cabeceras.toArray()); while (resultadoMostrarOT.next()) { ArrayList lista = new ArrayList(); for (int i = 0; i < cantidadColumnas; i++) { lista.add(i, resultadoMostrarOT.getString(i + 1)); } modelo.addRow(lista.toArray()); } tabla.setModel(modelo); tabla.setAutoCreateRowSorter(true); tabla.setAutoscrolls(true); }
private int addValue( final Object extraData, final int row, final DefaultTableModel model, final String desc, final int count, final AnnotatedRowsResult sampleResult) { model.setValueAt(desc, row, 0); if (sampleResult == null || count == 0) { model.setValueAt(count, row, 1); } else { final DCPanel panel = new DCPanel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); final JLabel label = new JLabel(count + ""); final JButton button = WidgetFactory.createSmallButton(IconUtils.ACTION_DRILL_TO_DETAIL); button.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { drillToGroup(desc, sampleResult); } }); panel.add(label); panel.add(Box.createHorizontalStrut(4)); panel.add(button); model.setValueAt(panel, row, 1); } addExtraValue(extraData, row, model, desc, count, sampleResult); return row + 1; }
private void preencherTabela(Vector linhas) { DefaultTableModel modelo = (DefaultTableModel) this.tbCargos.getModel(); int numLinhas = linhas.size(); for (int i = 0; i < numLinhas; i++) { modelo.insertRow(modelo.getRowCount(), (Vector) linhas.get(i)); } }
private void checkConstraints(DiscapacidadDetalle toAdd) throws MessageException { if (toAdd.getPeriodoYear() == null) { throw new MessageException("Número de carpeta no válida"); } DefaultTableModel dtm = (DefaultTableModel) abmPanel.getjTable1().getModel(); for (int row = 0; row < dtm.getRowCount(); row++) { DiscapacidadDetalle oldDiscapacidadDetalle = (DiscapacidadDetalle) dtm.getValueAt(row, 0); if (oldDiscapacidadDetalle.getTipoDocumento().equals(toAdd.getTipoDocumento()) && Objects.equals( oldDiscapacidadDetalle.getSubTipoDocumento(), toAdd.getSubTipoDocumento()) && Objects.equals(oldDiscapacidadDetalle.getDocumentoNumero(), toAdd.getDocumentoNumero()) && Objects.equals(oldDiscapacidadDetalle.getPeriodoYear(), toAdd.getPeriodoYear()) && Objects.equals(oldDiscapacidadDetalle.getNombre(), toAdd.getNombre()) && Objects.equals(oldDiscapacidadDetalle.getApellido(), toAdd.getApellido())) { throw new MessageException( "Ya existe un detalle con los mismos datos:" + "\nTipo de Documento: " + toAdd.getTipoDocumento().getNombre() + "\nSub-Tipo de Documento: " + (toAdd.getSubTipoDocumento() == null ? "<Sin Sub-Tipo>" : toAdd.getSubTipoDocumento().getNombre()) + "\nN° Documento: " + Objects.toString(toAdd.getDocumentoNumero(), "") + "\nPeriodo: " + Objects.toString(toAdd.getPeriodoYear(), "") + "\nNombre: " + (toAdd.getApellido() == null ? "" : toAdd.getApellido() + ", ") + (Objects.toString(toAdd.getNombre(), ""))); } } }
/** Creates new form Baitap1_1 */ public Baitap1_1() { initComponents(); _tfMaSinhVien.setEnabled(false); _tfTenSinhVien.setEnabled(false); _tfNgaySinh.setEnabled(false); _btHuy.setVisible(false); modelTable = new DefaultTableModel(); modelTable.addColumn("Mã sinh viên"); modelTable.addColumn("Tên sinh viên"); modelTable.addColumn("Ngày sinh"); _FileChooser.setFileFilter(new FileNameExtensionFilter("*.txt", "txt")); _tbleDanhSachSinhVien .getSelectionModel() .addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) { _tfMaSinhVien.setText( _tbleDanhSachSinhVien .getValueAt(_tbleDanhSachSinhVien.getSelectedRow(), 0) .toString()); _tfTenSinhVien.setText( _tbleDanhSachSinhVien .getValueAt(_tbleDanhSachSinhVien.getSelectedRow(), 1) .toString()); _tfNgaySinh.setText( _tbleDanhSachSinhVien .getValueAt(_tbleDanhSachSinhVien.getSelectedRow(), 2) .toString()); } }); }
private void cargarTablaBuscador(List<DiscapacidadDetalle> list) { DefaultTableModel dtm = buscador.getDtm(); dtm.setRowCount(0); for (DiscapacidadDetalle detalle : list) { dtm.addRow( new Object[] { detalle.getDiscapacidad(), detalle.getTipoDocumento().getNombre(), detalle.getSubTipoDocumento() != null ? detalle.getSubTipoDocumento().getNombre() : null, detalle.getDocumentoNumero(), detalle.getDocumentoFecha() == null ? null : UTIL.DATE_FORMAT.format(detalle.getDocumentoFecha()), Objects.toString(detalle.getApellido(), "") + " " + Objects.toString(detalle.getNombre(), ""), detalle.getPeriodoYear(), detalle.getObservacion(), detalle.getDiscapacidad().getBarcode(), detalle.getDiscapacidad().getPrecintos().isEmpty() ? "No" : "Si " + detalle.getDiscapacidad().getPrecintos().size(), detalle.getDiscapacidad().getRecibo() != null ? detalle.getDiscapacidad().getRecibo().getNumero() : null }); } }
// Metodo que lee los camareros de la base de datos y los coloca en la tabla cuando la ventana es // cargada. Llamo a este método en el constructor. public void llenarTabla() { try { // Accedo a la base de datos con la instancia Singleton que creé y me conecto a ella. conn = basedatos.getConnection(); sentencia = conn.createStatement(); ResultSet resultado = sentencia.executeQuery( "SELECT p_camarero, \n" + "nombre, \n" + "apellidos \n" + "FROM camarero"); DefaultTableModel dtm = (DefaultTableModel) tabla.getModel(); while (resultado.next()) { Object[] fila = new Object[3]; fila[0] = resultado.getInt("p_camarero"); fila[1] = resultado.getString("nombre"); fila[2] = resultado.getString("apellidos"); dtm.addRow(fila); } // Desconecto resultado.close(); conn.close(); sentencia.close(); } catch (SQLException ex) { Logger.getLogger(Categoria.class.getName()).log(Level.SEVERE, null, ex); } }
private void populateTable() { DefaultTableModel tableModel = (DefaultTableModel) tblAccounts.getModel(); tableModel.getDataVector().removeAllElements(); if (lines.size() > 0) { int i = 0; for (; i < lines.size(); i++) { AccountsLine l = lines.get(i); tableModel.insertRow( i, new Object[] { l.getDate(), l.getDocType(), l.getLine_desc(), l.getDebit_amount(), l.getCredit_amount(), l.getLine_balance() }); } } else { tableModel.insertRow(0, new Object[] {"", "", "", "", "", ""}); } populateSummery(report); }
private JScrollPane legendChart(int width, int height, List<String> rows) { JScrollPane jcp = new JScrollPane(); DefaultTableModel dtm = new DefaultTableModel( new Object[][] {}, new String[] {"File", "Bar", "Type Query", "Time(ms)"}); JTable jt = new JTable(); jt.setModel(dtm); for (String s : rows) { if (s != null) { String[] vals = s.split("\\|"); dtm.addRow(new String[] {vals[0], vals[3], vals[1], vals[2]}); } } jt.getColumnModel().getColumn(0).setPreferredWidth(200); jt.getColumnModel().getColumn(1).setPreferredWidth(50); jt.getColumnModel().getColumn(2).setPreferredWidth(50); jt.getColumnModel().getColumn(3).setPreferredWidth(50); // jt.setEnabled(false); jcp.setViewportView(jt); jcp.setPreferredSize(new Dimension(width, height)); jcp.setBackground(Color.WHITE); jcp.createHorizontalScrollBar(); return jcp; }
private void statusTabel(JTable tabela) { DefaultTableModel modelo = (DefaultTableModel) tabela.getModel(); if (modelo.getRowCount() == 0) { modelo.addRow(new String[1]); tabela.setValueAt("Nenhuma Pendência", 0, 0); } }
private void jButton5ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton5ActionPerformed int rows2Delete = jTable1.getSelectedRowCount(); int[] selectedRows = jTable1.getSelectedRows(); if (rows2Delete < 1) { java.awt.Toolkit.getDefaultToolkit().beep(); javax.swing.JOptionPane.showMessageDialog(this, "There are no selected rows to delete!"); } else { if (rows2Delete > 1) { for (int i = 0; i < selectedRows.length; i++) { javax.swing.table.DefaultTableModel defTableModel = (javax.swing.table.DefaultTableModel) jTable1.getModel(); defTableModel.removeRow(selectedRows[i]); } } else { javax.swing.table.DefaultTableModel defTableModel = (javax.swing.table.DefaultTableModel) jTable1.getModel(); defTableModel.removeRow(jTable1.getSelectedRow()); } } // Add your handling code here: } // GEN-LAST:event_jButton5ActionPerformed
private JTable initSessionList() { final JPopupMenu popupMenu = new JPopupMenu(); JMenuItem removeItem = new JMenuItem(BundleUtil.getString(BundleUtil.Command_Delete)); removeItem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { remove(); } }); popupMenu.add(removeItem); sessionListModel = new DefaultTableModel() { @Override public boolean isCellEditable(int row, int column) { return false; } }; TableSorter sorter = new TableSorter(sessionListModel); JTable sessionsTable = new JTable(sorter); sessionsTable.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { JTable table = (JTable) e.getSource(); int currentRow = table.rowAtPoint(e.getPoint()); if (currentRow >= 0) { table.setRowSelectionInterval(currentRow, currentRow); } } @Override public void mousePressed(MouseEvent e) { JTable table = (JTable) e.getSource(); int currentRow = table.rowAtPoint(e.getPoint()); if (currentRow >= 0) { table.setRowSelectionInterval(currentRow, currentRow); } currentSession = (Long) table.getValueAt(table.rowAtPoint(e.getPoint()), 0); if (e.getButton() == 3) { popupMenu.show(table, e.getX(), e.getY()); } } }); sorter.setTableHeader(sessionsTable.getTableHeader()); sessionListModel.addColumn("会话ID"); sessionListModel.addColumn("用户名"); sessionListModel.addColumn("IP地址"); sessionListModel.addColumn("创建时间"); sessionListModel.addColumn("操作"); sessionListModel.addColumn("注销时间"); return sessionsTable; }
/** * Retrieves program counter * * @param program assembly language program * @return (int) program counter */ public void addInstructions() { for (int i = 0; i < simulator.getCodeSegmentFile().size(); i++) { boolean end = false; String instruction = simulator.getCodeSegmentFile().get(i).toString(); String label = ""; String endlabel = ""; Set<String> table = SymbolTable.getInstance().getSymbolTable().keySet(); for (String key : table) { int location = SymbolTable.getInstance().getLocation(key); String type = SymbolTable.getInstance().getType(key); if (location == i && type.equals("code")) { label = " " + key; } if (location > (simulator.getCodeSegmentFile().size() - 1) && i == simulator.getCodeSegmentFile().size() - 1) { endlabel = key; end = true; } } String[] temp = { (simulator.getCodeSegmentFile().get(i).getSize() * (i + 1)) + " " + label, instruction }; model.addRow(temp); if (end) { String[] endTemp = { (simulator.getCodeSegmentFile().get(i).getSize() * (i + 1) + 2) + " " + endlabel, " " }; model.addRow(endTemp); } } }
private void WarehouseCBActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_WarehouseCBActionPerformed int warehouseindex = st.getWarehouseIndex(((String) WarehouseCB.getSelectedItem()).toLowerCase()); QuantityLB.setText( "Total Quantity: " + st.getTotalQuantityByWarehouseAndCode( ((String) WarehouseCB.getSelectedItem()).toLowerCase(), item_code)); ArrayList<String[]> quantity_expired_list = st.setQuantityExpiredDateTable(warehouseindex, itemindex); DefaultTableModel quantity_expired_model = (DefaultTableModel) QuantityTB.getModel(); GuiHelper.ClearAllTable(QuantityTB); quantity_row_length = quantity_expired_list.size(); for (int i = 0; i < quantity_row_length; i++) { if (i == quantity_expired_model.getRowCount()) { ((DefaultTableModel) quantity_expired_model) .addRow( new Object[] { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null }); } String[] single_list = (String[]) quantity_expired_list.get(i); quantity_expired_model.setValueAt(single_list[0], i, 0); quantity_expired_model.setValueAt(single_list[1], i, 1); } } // GEN-LAST:event_WarehouseCBActionPerformed
void mostrarTabla() { modelTablaSalidas = null; arrayListSalidas = null; arrayListSalidas = gestionSalidas.getSalidas(); System.out.println(arrayListSalidas); modelTablaSalidas = new DefaultTableModel() { public boolean isCellEditable(int rowIndex, int columnIndex) { return false; } }; String[] cabecera = {"cod_salida", "Fecha", " Hora", "Coordinador", "Voluntario"}; modelTablaSalidas.setColumnIdentifiers(cabecera); for (int i = 0; i < arrayListSalidas.size(); i++) { String[] arraySalida = { "" + arrayListSalidas.get(i).getCod_salida(), "" + arrayListSalidas.get(i).getFecha(), "" + arrayListSalidas.get(i).getHora(), "" + arrayListSalidas.get(i).getCod_Coordinador(), " " + arrayListSalidas.get(i).getCod_voluntario() }; modelTablaSalidas.addRow(arraySalida); } jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTable1.setModel(modelTablaSalidas); // Ocultar columna de idContacto TableColumn tc = jTable1.getColumn("cod_salida"); jTable1.removeColumn(tc); }
@Override public void selectCategory(int indexCategory, JTable proTable) { products.clear(); proIndexes.clear(); String category_id = catIndexes.get(indexCategory); products = (new Products()).getList(0, category_id, "NULL", "NULL"); if (!products.isEmpty()) { DefaultTableModel model = (DefaultTableModel) proTable.getModel(); head(model); for (Products product : products) { model.addRow( new Object[] { product.getProduct_id(), product.getParent_product_id(), product.getProduct_name(), product.getProduct_price(), product.getProduct_color(), product.getProduct_size(), product.getRegister_state() }); } } else JOptionPane.showMessageDialog( null, "There is not any product to show.", "Products", JOptionPane.INFORMATION_MESSAGE); }