private void pripremiFormu(int brStola) { List<Narudzbina> listaNarudzbina = null; List<Pice> listaPica = null; try { listaPica = Kontroler.getInstance().vratiPica(); } catch (Exception ex) { Logger.getLogger(JPanelSto.class.getName()).log(Level.SEVERE, null, ex); } try { listaNarudzbina = Kontroler.getInstance().vratiNarudzbe(brStola); } catch (Exception ex) { Logger.getLogger(JPanelSto.class.getName()).log(Level.SEVERE, null, ex); } jComboBoxPica.setModel(new DefaultComboBoxModel(listaPica.toArray())); TableModelSto tm = new TableModelSto(listaNarudzbina); jTableNarudzbine.setModel(tm); }
private void jButtonKrajActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButtonKrajActionPerformed TableModelSto tm = (TableModelSto) jTableNarudzbine.getModel(); try { Kontroler.getInstance().sacuvajUpdateUBazi(tm.getLista()); } catch (Exception ex) { Logger.getLogger(JPanelSto.class.getName()).log(Level.SEVERE, null, ex); } this.getTopLevelAncestor().setVisible(false); } // GEN-LAST:event_jButtonKrajActionPerformed
private void jButtonStampajActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButtonStampajActionPerformed TableModelSto tm = (TableModelSto) jTableNarudzbine.getModel(); try { Kontroler.getInstance().obrisiIzBaze(stoid); } catch (Exception ex) { Logger.getLogger(JPanelSto.class.getName()).log(Level.SEVERE, null, ex); } PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(new PrintRacun()); boolean doPrint = job.printDialog(); if (doPrint) { try { job.print(); } catch (PrinterException e) { } } this.getTopLevelAncestor().setVisible(false); } // GEN-LAST:event_jButtonStampajActionPerformed