public void atualizaFormulario(Fornecedor objFornec) { textField_2.setText(objFornec.getTelFornec()); textField_4.setText(objFornec.getRuaFornec()); textField_6.setText(objFornec.getNumEndFornec()); textField_7.setText(objFornec.getBairroFornec()); textField_8.setText(objFornec.getCidadeFornec()); textField.setText(objFornec.getNomeFornec()); textField_3.setText(objFornec.getCepFornec()); textField_9.setText(objFornec.getComplFornec()); Integer matr = objFornec.getNumFornec(); textField_5.setText(matr.toString()); lista.setVisible(false); formulario.setVisible(true); buttonPanel.setVisible(false); }
public void atualizaLista(JTable lista, String nome) throws DaoException { DefaultTableModel dtm = (DefaultTableModel) table.getModel(); ImageIcon editar = new ImageIcon(CadFuncionario.class.getResource("/br/com/images/editar.png")); ImageIcon excluir = new ImageIcon(CadFuncionario.class.getResource("/br/com/images/icon_excluir.png")); TableColumnModel columnModel = table.getColumnModel(); JTableRenderer renderer = new JTableRenderer(); JTableRenderer renderer1 = new JTableRenderer(); renderer.setValue(editar); renderer.setHorizontalAlignment(JLabel.CENTER); renderer.setToolTipText("Editar"); columnModel.getColumn(3).setCellRenderer(renderer); renderer1.setValue(excluir); renderer1.setHorizontalAlignment(JLabel.CENTER); renderer1.setToolTipText("Excluir"); columnModel.getColumn(4).setCellRenderer(renderer1); dtm.setRowCount(0); List<Fornecedor> listaFornec = new ArrayList<Fornecedor>(); listaFornec = fornecDao.consultarFornecedores(nome); String dados[] = new String[3]; for (Fornecedor obj : listaFornec) { dados[0] = String.valueOf(obj.getNumFornec()); dados[1] = obj.getNomeFornec(); dados[2] = obj.getTelFornec(); ((DefaultTableModel) table.getModel()).addRow(dados); } table.setDefaultRenderer(Object.class, new TableCellRenderer()); table.repaint(); }