This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package mx.ticom.jtableexample; | |
| import java.awt.BorderLayout; | |
| import javax.swing.JFrame; | |
| import javax.swing.JScrollPane; | |
| import javax.swing.JTable; | |
| import javax.swing.table.DefaultTableModel; | |
| public class Tabla extends JFrame { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | private Document crearDocumento(PdfDocument pdfDoc) throws IOException { | |
| Rectangle rectangle3x5 = new Rectangle(216, 360); | |
| PageSize pagesize3x5 = new PageSize(rectangle3x5); | |
| Document documento = new Document(pdfDoc, pagesize3x5); | |
| documento.setLeftMargin(10.0f); | |
| documento.setRightMargin(10.0f); | |
| PdfFont fuente = PdfFontFactory.createFont(StandardFonts.COURIER_BOLD); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | EventoOperacionRapida eventoOperacionRapida = new EventoOperacionRapida(barraEvento); | |
| botonOperacionRapida.addActionListener(eventoOperacionRapida); | |
| EventoOperacionLenta eventoOperacionLenta = new EventoOperacionLenta(barraValue); | |
| botonOperacionLenta.addActionListener(eventoOperacionLenta); | |
| EventoOperacionSwingWorker eventoOperacionSwingWorker = new EventoOperacionSwingWorker(barraListener); | |
| botonOperacionSwingWorker.addActionListener(eventoOperacionSwingWorker); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class EventoOperacionSwingWorker implements ActionListener { | |
| private final JProgressBar barra; | |
| public EventoOperacionSwingWorker(JProgressBar b){ | |
| barra = b; | |
| } | |
| @Override | |
| public void actionPerformed(ActionEvent e) { | |
| ProcesoReporte procesoReporte = new ProcesoReporte(); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class EventoPropertyListener implements PropertyChangeListener { | |
| private final JProgressBar barraProgreso; | |
| public EventoPropertyListener(JProgressBar barra) { | |
| barraProgreso = barra; | |
| } | |
| @Override | |
| public void propertyChange(PropertyChangeEvent evt) { | |
| // Checamos si la propiedad modificada es progress | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class ProcesoReporte extends SwingWorker<Void, Void>{ | |
| public ProcesoReporte() { | |
| this.setProgress(0); | |
| } | |
| private int calcularAvance(int cantidadRegistros, int posicion) { | |
| Double indice = Double.valueOf(posicion); | |
| Double total = Double.valueOf(cantidadRegistros - 1); | |
| double avance = (indice / total) * 100.0; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class EventoOperacionLenta implements ActionListener { | |
| private final JProgressBar barra; | |
| public EventoOperacionLenta(JProgressBar b) { | |
| barra = b; | |
| } | |
| private int calcularAvance(int cantidadRegistros, int posicion) { | |
| Double indice = Double.valueOf(posicion); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class EventoOperacionRapida implements ActionListener { | |
| private JProgressBar barra; | |
| Integer valor = 0; | |
| Boolean direccion = true; | |
| public EventoOperacionRapida(JProgressBar b) { | |
| barra = b; | |
| } | |
| @Override | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class EventoProgreso implements PropertyChangeListener { | |
| private final JProgressBar barraProgreso; | |
| public EventoProgreso(JProgressBar barra) { | |
| barraProgreso = barra; | |
| } | |
| @Override | |
| public void propertyChange(PropertyChangeEvent evt) { | |
| // Checamos si la propiedad modificada es progress | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class ProcesoReporte extends SwingWorker<Void, Void>{ | |
| public ProcesoReporte() { | |
| this.setProgress(0); | |
| } | |
| public void generarExcel() throws FileNotFoundException, IOException { | |
| XSSFWorkbook libro = new XSSFWorkbook(); | |
| XSSFSheet pagina = libro.createSheet("Pagina"); | |
| GeneradorDatos generadorDatos = new GeneradorDatos(); | |
| ArrayList<Double> datos = generadorDatos.datos(); |