panel.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                if (panel.getSelectedComponent() == reportePanel) {
                    SwingAlert.mostrarAdvertencia("cambio de pestaña", panel);
                    agregarPestañaReporte();
                }
            }
   });
------------------------
  private void agregarPestañaReporte() {
        if (entidad != null) {
       
            HashMap parametros = new HashMap();
            parametros.put("TRIP_ID", entidad.getId());
           
            try {
                if (tripReport == null) {
                    String ubicacion = "/inertial/uncorking/Trips.jrxml";
                    InputStream stream = TripWindows.class.getResourceAsStream(ubicacion);
                    tripReport = JasperCompileManager.compileReport(stream);
                    subreporte = JasperCompileManager.compileReport(TripWindows.class.getResourceAsStream("/inertial/uncorking/SubReportPasajeros.jrxml"));
                }
                parametros.put("SUBREPORTE_PASAJEROS", subreporte);
                reportePanel.removeAll();
                JasperPrint jp = JasperFillManager.fillReport(tripReport, parametros, UncorkingMain.CONN);
                reporte = new JRViewer(jp);
                reportePanel.add(reporte, BorderLayout.CENTER);
            } catch (JRException ex) {
                Logger.getLogger(TripWindows.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
Suscribirse a:
Enviar comentarios (Atom)
 
No hay comentarios:
Publicar un comentario