示例#1
0
  // no funciona
  public void cargarFecha(int id) {
    if (!Base.hasConnection()) {
      Base.open("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/quiniela", "tecpro", "tecpro");
    }
    if (!(tablaProducto
        .getValueAt(view.getTablaProductos().getSelectedRow(), 4)
        .equals(Boolean.FALSE))) {
      getView().getInsertar().setEnabled(true);
      getView().getQuitar().setEnabled(true);
      tablaFecha.setRowCount(0);
      listaFS = Fecha.where("producto_id = ?", id);
      Iterator<Fecha> itr = listaFS.iterator();
      while (itr.hasNext()) {
        Fecha p = itr.next();
        Object row[] = new Object[1];
        row[0] = p.getString("diaDeposito");
        tablaFecha.addRow(row);
      }
      tablaFecha.addRow(new Object[1]);
    } else {
      tablaFecha.setRowCount(0);
      getView().getInsertar().setEnabled(false);
      getView().getQuitar().setEnabled(false);
    }

    if (Base.hasConnection()) {
      Base.close();
    }
  }
 public void reset() {
   tableMode.setRowCount(0);
   constructorInfo = null;
   methodInfo = null;
   searchTextField.setText("");
   switchSearchFunction();
 }
  private void populateTable() {
    DefaultTableModel model = (DefaultTableModel) billjTable1.getModel();

    model.setRowCount(0);
    for (Network n : business.getNetworkList()) {
      for (Enterprise enterprise : n.getEnterpriseDirectory().getEnterpriseList()) {

        if (enterprise instanceof DistributorEnterprise) {
          for (WorkRequest request : enterprise.getWorkQueue().getWorkRequestList()) {

            Object[] row = new Object[5];
            row[0] = request;
            // row[] = request.getSender().getEmployee().getName();
            row[1] =
                request.getReceiver() == null
                    ? null
                    : request.getReceiver().getEmployee().getName();
            row[2] = ((ProviderWorkRequest) request).getOrder();
            row[3] = ((ProviderWorkRequest) request).getTotalPrice();
            row[4] = request.getStatus();

            model.addRow(row);
          }
        }
      }
    }
  }
 public void initTable() {
   DefaultTableModel model = (DefaultTableModel) m_table.getModel();
   model.setRowCount(0);
   for (int i = 0; i < m_isiTable.length; i++) {
     model.addRow(new Object[] {new Boolean(false), m_isiTable[i]});
   }
 }
  public CustomLeagueTable(String teamAmount) {

    model = new DefaultTableModel();
    table =
        new JTable(model) {
          @Override
          public boolean isCellEditable(int row, int column) {
            return true;
          }
        };
    model.setColumnIdentifiers(
        new String[] {
          "Team Name", "Points", "Goal Diff", "Wins", "Loses", "Draws", "Played", "League Verdict"
        });
    model.setRowCount(Integer.parseInt(teamAmount));

    JScrollPane pane =
        new JScrollPane(
            table,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    pane.setPreferredSize(INITIAL_SIZE);
    setVisible(true);
    setLayout(new FlowLayout());

    table.setRowSelectionAllowed(false);

    TableColumn colTeamName = table.getColumnModel().getColumn(0);
    colTeamName.setPreferredWidth(150);

    TableColumn colVerdict = table.getColumnModel().getColumn(4);
    colVerdict.setPreferredWidth(290);

    add(pane);
  }
 protected void clearItems() {
   for (TableItem i : mItems.values()) {
     i.mValue.deleteObserver(i);
   }
   mModel.setRowCount(0);
   mItems.clear();
 }
示例#7
0
 public void actionPerformed(ActionEvent e) {
   if (e.getActionCommand().equals("Add Column")) {
     PopMessage.popMsg("Invalid new column for this window");
     // defaultModel.addColumn("AddColumn");
   }
   if (e.getActionCommand().equals("Add Row")) defaultModel.addRow(new Vector());
   if (e.getActionCommand().equals("Remove Column")) {
     PopMessage.popMsg("Invalid new column for this window");
     //            int columncount = defaultModel.getColumnCount() - 1;
     //            if (columncount >= 0) {
     //                TableColumnModel columnModel = table.getColumnModel();
     //                TableColumn tableColumn = columnModel.getColumn(columncount);
     //                columnModel.removeColumn(tableColumn);
     //                defaultModel.setColumnCount(columncount);
     //            }
   }
   if (e.getActionCommand().equals("Remove Row")) {
     int rowcount = defaultModel.getRowCount() - 1;
     if (rowcount >= 0) {
       defaultModel.removeRow(rowcount);
       defaultModel.setRowCount(rowcount);
     }
   }
   table.revalidate();
 }
示例#8
0
  // 이미지 서버
  public void viewImgaeSearch() {

    dtm.setRowCount(0);
    // 검색시 서버에서 이미지를 불러옵니다.
    ms_connect.setImageSetting();
    String query =
        "Select * From Ftp_Image Where path='"
            + Server_Config.getFTPMARTPATH()
            + "' and path_gubun='0' ";
    ArrayList<HashMap<String, String>> temp_map = ms_connect.connection(query);

    Iterator<HashMap<String, String>> iter = temp_map.iterator();
    int i = 1;
    while (iter.hasNext()) {
      HashMap<String, String> map = iter.next();
      Vector<String> item = new Vector<String>();
      item.add(String.valueOf(i++));
      item.add(map.get("Barcode"));
      item.add(map.get("Ext"));
      item.add(map.get("G_Name"));

      dtm.addRow(item);
    }

    label_show_image.setIcon(null);
  }
 /** Creates new form DialogoAnadirElemento */
 public DialogoModificarIngrediente(
     java.awt.Frame parent, /* IProducto AlmacenProductos, IGestionarProducto GestorProductos*/
     ICocinero iCocinero) {
   super(parent, false);
   initComponents();
   /*this.gestorProductos = GestorProductos;
   this.almacenProductos = AlmacenProductos;*/
   ArrayList<Ingrediente> listaIngredientes = this.almacenProductos.obtenerListaIngredientes();
   DefaultTableModel modelo = new DefaultTableModel();
   modelo.addColumn(this.tTablaIngredientesDisponibles.getColumnName(0));
   modelo.addColumn(this.tTablaIngredientesDisponibles.getColumnName(1));
   modelo.addColumn(this.tTablaIngredientesDisponibles.getColumnName(2));
   modelo.setRowCount(listaIngredientes.size());
   this.tTablaIngredientesDisponibles.setModel(modelo);
   this.tTablaIngredientesDisponibles
       .getColumnModel()
       .getColumn(2)
       .setCellRenderer(new ImageRenderer());
   this.tTablaIngredientesDisponibles.setRowHeight(50);
   for (int i = 0; i < listaIngredientes.size(); i++) {
     this.tTablaIngredientesDisponibles.setValueAt(listaIngredientes.get(i).getNombre(), i, 0);
     this.tTablaIngredientesDisponibles.setValueAt(listaIngredientes.get(i).getCantidad(), i, 1);
     this.tTablaIngredientesDisponibles.setValueAt(listaIngredientes.get(i).getImagen(), i, 2);
   }
   this.bSiguiente.setEnabled(false);
   this.estado = 1;
   this.bAnterior.setEnabled(false);
   this.dSelector.setFileFilter(
       new FileNameExtensionFilter("IMAGEN", "jpg", "jpeg", "png", "gif"));
 }
  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);
      }
    }
  }
 /**
  * Fill the displayed List with the selectet shifts
  *
  * @param shifts
  */
 private void fillList(ArrayList<ShiftInstance> shifts) {
   displayTableModel.setRowCount(0);
   for (int i = 0; i < shifts.size(); i++) {
     try {
       ShiftInstance shiftInstance = shifts.get(i);
       String dateString = shiftInstance.getDateString();
       calendar.setTime(sdf.parse(dateString));
       String dayOfWeek = UtilityBox.getDayOfWeekString(calendar.get(Calendar.DAY_OF_WEEK));
       String fromToString =
           UtilityBox.createTimeStringFromInt(shiftInstance.getActualStartingTimeWithPrepTime())
               + " - "
               + UtilityBox.createTimeStringFromInt(shiftInstance.getActualEndTime());
       String[] rowData =
           new String[] {
             dayOfWeek + ", " + dateString,
             fromToString,
             shiftInstance.getType().toString(),
             shiftInstance.getPartner()
           };
       displayTableModel.addRow(rowData);
     } catch (ParseException ex) {
       UtilityBox.getInstance()
           .displayErrorPopup(
               "Schicht-Anzeige", "Datum konnte nicht gelesen werden:\n" + ex.getMessage());
     }
   }
 }
示例#12
0
 public void cargarProductos() {
   if (!Base.hasConnection()) {
     Base.open("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/quiniela", "tecpro", "tecpro");
   }
   tablaProducto.setRowCount(0);
   listaProd = Producto.where("visible = ?", 1);
   Iterator<Producto> itr = listaProd.iterator();
   while (itr.hasNext()) {
     Producto p = itr.next();
     Object row[] = new Object[6];
     row[0] = p.get("id");
     row[1] = p.getString("nombre");
     row[2] = p.getBigDecimal("precio").doubleValue();
     row[3] = p.getBigDecimal("comision").doubleValue();
     if (p.getInteger("hayStock") == 0) {
       row[4] = false;
     } else {
       row[4] = true;
       row[5] = p.getInteger("stock");
     }
     tablaProducto.addRow(row);
   }
   if (Base.hasConnection()) {
     Base.close();
   }
 }
示例#13
0
  public void ListaKontrahentow() {
    DefaultTableModel table = new DefaultTableModel();
    Kontrahent objKontrahent = new Kontrahent();
    ArrayList<Kontrahent> listaKontrahentow = new ArrayList();
    listaKontrahentow = objKontrahent.ListaKontrahentów();

    table.addColumn("id");
    table.addColumn("Skrót");
    table.addColumn("Nazwa");
    table.addColumn("NIP");
    table.setRowCount(listaKontrahentow.size());
    int i = 0;
    // System.out.println("lista size = " + lista3.size());
    for (Kontrahent x : listaKontrahentow) {
      table.setValueAt(x.getId(), i, 0);
      table.setValueAt(x.getSkrot(), i, 1);
      table.setValueAt(x.getNazwa(), i, 2);
      table.setValueAt(x.getNip(), i, 3);
      i++;
    }

    this.jTable1.setModel(table);
    jTable1.getColumnModel().getColumn(0).setMinWidth(0);
    jTable1.getColumnModel().getColumn(0).setMaxWidth(0);
    jTable1.getColumnModel().getColumn(0).setPreferredWidth(0);
  }
  /**
   * Set the {@link BuildOutput}s that should be shown in this panel. A copy of the given collection
   * will be stored internally. If the collection is <code>null</code>, then an empty list will be
   * stored.
   *
   * @param buildOutputs The {@link BuildOutput}s
   */
  void setBuildOutputs(Collection<? extends BuildOutput> buildOutputs) {
    if (buildOutputs == null) {
      this.buildOutputs = Collections.emptyList();
    } else {
      this.buildOutputs = new ArrayList<BuildOutput>(buildOutputs);
    }

    projectsTableModel.setRowCount(0);
    for (BuildOutput buildOutput : buildOutputs) {
      String projectName = buildOutput.getProjectName();
      boolean skipped = buildOutput.isSkippedBuild();
      List<CompilerMessage> compilerWarnings = buildOutput.getCompilerWarnings();
      int numCompilerWarnings = compilerWarnings.size();
      List<CompilerMessage> compilerErrors = buildOutput.getCompilerErrors();
      int numCompilerErrors = compilerErrors.size();
      List<LinkerMessage> linkerWarnings = buildOutput.getLinkerWarnings();
      int numLinkerWarnings = linkerWarnings.size();
      List<LinkerMessage> linkerErrors = buildOutput.getLinkerErrors();
      int numLinkerErrors = linkerErrors.size();
      boolean hasIncludes = !buildOutput.getIncludes().isEmpty();

      projectsTableModel.addRow(
          new Object[] {
            projectName,
            skipped,
            numCompilerWarnings,
            numCompilerErrors,
            numLinkerWarnings,
            numLinkerErrors,
            hasIncludes
          });
    }
    JTables.adjustColumnWidths(projectsTable, Short.MAX_VALUE);
  }
示例#15
0
 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
         });
   }
 }
示例#16
0
 public void mostrarIncidencias() {
   ArrayList<Incidencia> lista = new ArrayList<Incidencia>();
   Usuario a;
   Especialista b;
   TipoIncidencia c;
   lista = inc.ListarIncidencias();
   tabla.setRowCount(0);
   // System.out.println(lista);
   for (Incidencia x : lista) {
     tabla.addRow(
         new Object[] {
           x.getCodigo(),
           usuar.bnombre(x.getCodUsu()),
           espec.bnombre(x.getCodEsp()),
           tipo.bnombre(x.getCodTipInc()),
           x.getDescripcion(),
           x.getComentarios(),
           x.getTiempoEst(),
           x.getTiempoReal(),
           x.getFecRegistro(),
           x.getFecInicio(),
           x.getFecFin(),
           ComboEstado(x.getEstado())
         });
   }
   TablaIncidencias.setModel(tabla);
 }
示例#17
0
  // Liste(als Array) in Tabelle ausgeben
  public void outputList(Object[] ar) { // Object[] als Übergabeparameter
    DefaultTableModel dtm =
        (DefaultTableModel) jTable1.getModel(); // TableModel um Tabelle zu verändern
    dtm.setRowCount(ar.length); // Anzahl der Reihen verändern

    jTable1.setRowHeight(
        (jScrollPane1.getHeight() - 5) / 12); // Größe der Reihen verändern damit es besser aussieht

    jTable1.setModel(dtm); // Model setzen

    for (int j = 0; j < ar.length; j++) { // Befüllt die Reihen mit dem Inhalt aus den Objekten
      if (ar[j] instanceof Vokabel) {
        Vokabel v = (Vokabel) ar[j];
        jTable1.setValueAt(j + 1, j, 0); // Die Nmr: #
        jTable1.setValueAt(v.getGerman(), j, 1); // Deutsches Wort
        jTable1.setValueAt(v.getForeign(), j, 2); // Fremdsprachenwort
        String k =
            ""
                + v.getDifficulty()
                + " "
                + Miscellaneous.getStars(v.getDifficulty()); // Schwierigkeit + Sterne
        jTable1.setValueAt(k, j, 3);
      }
    }
  }
 private void btnGuardarActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnGuardarActionPerformed
   gestorBitacora gestorB = new gestorBitacora();
   Iterator ite = gestorH.listarClase(Viaje.class).iterator();
   while (ite.hasNext()) {
     Viaje viaje = (Viaje) ite.next();
     if (viaje.getIdViaje() == Long.parseLong(txtNumViaje.getText())) {
       Iterator ite1 = gestorH.listarClase(Vehiculo.class).iterator();
       while (ite1.hasNext()) {
         Vehiculo vehiculo = (Vehiculo) ite1.next();
         if (vehiculo.getDominio().equalsIgnoreCase(txtDominio.getText())) {
           viaje.setVehiculo(vehiculo);
           viaje.setEstado("Con vehiculo asignado");
           gestorH.actualizarObjeto(viaje);
           vehiculo.setEstado("Asignado");
           gestorH.actualizarObjeto(vehiculo);
           gestorB.cargarBitacora(
               String.valueOf(viaje.getIdViaje()),
               txtFecha.getText(),
               3,
               labelusuario.getText(),
               "");
         }
       }
     }
   }
   DefaultTableModel modeloT = (DefaultTableModel) tblViaje.getModel();
   modeloT.setRowCount(0);
   gestorA.RellenarTablaViajes(tblViaje);
   txtNumeroSolicitud.setText("");
   txtDestino.setText("");
   txtCereal.setText("");
   txtFechaRealizacion.setText("");
   txtTipoViaje.setText("");
   txtNumViaje.setText("");
   txtProductor.setText("");
   DefaultTableModel modelo = (DefaultTableModel) tblVehiculo.getModel();
   modelo.setRowCount(0);
   txtVehiculo.setText("");
   txtTara.setText("");
   txtTipoVehiculo.setText("");
   txtTransportista.setText("");
   txtDominio.setText("");
   JOptionPane.showMessageDialog(null, "Se asigno correctamente el vehiculo");
 } // GEN-LAST:event_btnGuardarActionPerformed
 @Override
 public void clear() {
   txtOrderNum.setText("");
   txtCustomer.removeAllItems();
   txtProduct.removeAllItems();
   txtQuantity.setText("");
   txtTotalPrice.setText("");
   defaultTableModel.setRowCount(0);
 }
  private void VooraadknopActionPerformed(java.awt.event.ActionEvent evt) {
    DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
    model.setRowCount(0);

    List<Product> producten = WinkelApplication.getQueryManager().getVoorraad();
    for (Product p : producten) {
      model.addRow(new Object[] {p.getProductId(), p.getName(), p.getAantal()});
    }
  }
 @Override
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == jbtPesquisar) {
     String nome = null;
     Boolean encontrou = false;
     nome = JOptionPane.showInputDialog("Insira  o nome do corretor.");
     if (nome == null || nome.equals("")) {
       JOptionPane.showMessageDialog(
           null, "Impossivel procurar por um nome vazio.", "Alerta", JOptionPane.ERROR_MESSAGE);
     } else {
       dbtCorretores.setRowCount(0);
       for (Corretor corretor : corretorDao.todos()) {
         if (corretor.getPessoa().getNome().toLowerCase().contains(nome.toLowerCase())) {
           encontrou = true;
           dbtCorretores.addRow(
               new String[] {
                 String.valueOf(corretor.getIdCorretor()),
                 corretor.getPessoa().getNome(),
                 String.valueOf(corretor.getPessoa().getRg())
               });
         }
       }
       if (encontrou == false) {
         JOptionPane.showMessageDialog(
             null,
             "Não foi encontrado nenhum nome parecido com [" + nome.toLowerCase() + "].",
             "Alerta!",
             JOptionPane.WARNING_MESSAGE);
       } else if (encontrou == true) {
         int resultados = dbtCorretores.getRowCount() + 1;
         JOptionPane.showMessageDialog(
             null,
             "Durante a pesquisa foram encontradas ["
                 + resultados
                 + "] pessoa(as) com o nome ["
                 + nome
                 + "]\nO resultado está sendo exibido na tabela!",
             "Resultado",
             JOptionPane.PLAIN_MESSAGE);
       }
     }
   }
   if (e.getSource() == jbtAtualizar) {
     alimentarTable();
   }
   if (e.getSource() == jbtSelecionar) {
     if (jtbCorretores.getSelectedRow() == -1) {
       JOptionPane.showMessageDialog(
           null, "Selecione uma linha para continuar!", "Alerta!", JOptionPane.ERROR_MESSAGE);
     } else {
       String id = String.valueOf(dbtCorretores.getValueAt(jtbCorretores.getSelectedRow(), 0));
       Corretor corretor = corretorDao.buscar(Integer.valueOf(id));
       telaPrincipal.getTlPrincipal().getTlCadastrarVenda().selecionouCorretor(corretor);
       this.setVisible(false);
     }
   }
 }
示例#22
0
 private void jButtonRefreshActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButtonRefreshActionPerformed
   try {
     DefaultTableModel defaultTable = (DefaultTableModel) positionTable.getModel();
     defaultTable.setRowCount(0);
   } catch (Exception e) {
     System.out.println(e.toString());
   }
   showTable(positionTable);
 } // GEN-LAST:event_jButtonRefreshActionPerformed
示例#23
0
 public void resetData(String[] headers, double[][] data) {
   tableModel.setRowCount(data[0].length);
   tableModel.setColumnCount(data.length);
   tableModel.setColumnIdentifiers(headers);
   for (int i = 0; i < data[0].length; i++) {
     for (int j = 0; j < data.length; j++) {
       tableModel.setValueAt(data[j][i], i, j);
     }
   }
 }
示例#24
0
 private void setPanelABM(Discapacidad afiliacion) {
   UTIL.setSelectedItem(abmPanel.getCbInstitucion(), afiliacion.getInstitucion().getNombre());
   abmPanel.setBarcode(SGDUtilities.getBarcode(afiliacion));
   DefaultTableModel dtm = (DefaultTableModel) abmPanel.getjTable1().getModel();
   dtm.setRowCount(0);
   for (DiscapacidadDetalle afiliacionDetalle : afiliacion.getDetalle()) {
     cargarTablaDetalle(afiliacionDetalle);
   }
   abmPanel.getBtnPrecintos().setEnabled(!afiliacion.getPrecintos().isEmpty());
 }
  @Override
  public void actionPerformed(ActionEvent arg0) {
    // TODO Auto-generated method stub
    if (arg0.getSource() == ajout) {

      Object[] row = new Object[4];
      row[0] = nom.getText();
      row[1] = dure.getText();
      row[2] = priorité.getText();
      row[3] = taille.getText();

      model1.addRow(row);
      t1.setModel(model1);
      Processus pp[] = new Processus[p.length + 1];
      for (int i = 0; i < p.length; i++) {
        pp[i] = p[i];
      }
      pp[p.length] =
          new Processus(
              row[0].toString(),
              Integer.parseInt(row[1].toString()),
              Integer.parseInt(row[2].toString()),
              Integer.parseInt(row[3].toString()));
      p = pp;
    }
    if (arg0.getSource() == fifo) {
      Ordonnanceur fi = new Ordonnanceur(p);
      fi.run();
      model2 = (DefaultTableModel) t2.getModel();
      model2.setRowCount(0);
      model2.setColumnCount(5);
      Object[] row2 = new Object[5];
      row2[0] = "Nom";
      row2[1] = "Durée";
      row2[2] = "Date debut";
      row2[3] = "TR";
      row2[4] = "TA";

      model2.addRow(row2);
      for (int i = 0; i < p.length; i++) {

        row2 = new Object[5];
        row2[0] = p[i].get_Nom();
        row2[1] = p[i].get_Duree();
        row2[2] = p[i].get_Date_deb();
        row2[3] = p[i].get_TR();
        row2[4] = p[i].get_TA();

        model2.addRow(row2);
        t2.setModel(model2);
      }
      ta.setText("Temps Moyenne d'attente: " + fi.taa / p.length);
      tr.setText("Temps Moyenne de Repponse:" + fi.trr / p.length);
    }
  }
示例#26
0
 public void actualizarTabla(String filtro) {
   this.setFiltro(filtro);
   ArrayList<Vector<Object>> tabla = new Aviones().recuperaTablaAviones(filtro);
   if (tabla != null) {
     DefaultTableModel dtm = (DefaultTableModel) getModel();
     dtm.setRowCount(0);
     for (Vector<Object> fila : tabla) {
       dtm.addRow(fila);
     }
   }
 }
  public void setTabStops(List<TabStop> tabStops) {
    DefaultTableModel dtm = (DefaultTableModel) jTableProperties.getModel();
    dtm.setRowCount(0);

    for (TabStop tabStop : tabStops) {
      Vector row = new Vector();
      row.addElement(tabStop.getPosition());
      row.addElement(tabStop.getAlignment().getValueByte());
      dtm.addRow(row);
    }
  }
 private void formComponentShown(
     java.awt.event.ComponentEvent evt) { // GEN-FIRST:event_formComponentShown
   // TODO add your handling code here:
   modelo = (DefaultTableModel) this.jTable1.getModel();
   modelo.setRowCount(0);
   ProductoControl pControl = new ProductoControl();
   List<Producto> productos = pControl.getAll();
   if (productos.isEmpty()) {
     modelo.setRowCount(0);
   } else {
     Object[] prod = new Object[3];
     for (int i = 0; i <= productos.size() - 1; i++) {
       Producto p = productos.get(i);
       prod[0] = p.getNombre();
       prod[1] = p.getPrecio();
       prod[2] = p.getCosto();
       modelo.addRow(prod);
     }
   }
 } // GEN-LAST:event_formComponentShown
示例#29
0
 private void head(DefaultTableModel model) {
   model.setRowCount(0);
   model.setColumnCount(0);
   model.addColumn("Id");
   model.addColumn("Parent Id");
   model.addColumn("Name");
   model.addColumn("Price");
   model.addColumn("Color");
   model.addColumn("Size");
   model.addColumn("State");
 }
 private void alimentarTable() {
   dbtCorretores.setRowCount(0);
   for (Corretor corretor : corretorDao.todos()) {
     dbtCorretores.addRow(
         new String[] {
           String.valueOf(corretor.getIdCorretor()),
           corretor.getPessoa().getNome(),
           corretor.getPessoa().getRg()
         });
   }
 }