Advertisement
LeonardoProgramador

Relatorio ireport

Aug 27th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. public void GerarRelatorio(String matricula,String nome,String cpf,String email) {
  2.        
  3. //parametros ! extremamente necessario
  4.      try{
  5.              Map parametro = new HashMap();
  6.         parametro.put("matricula", matricula);
  7.         parametro.put("nome", nome);
  8.         parametro.put("cpf", cpf);
  9.         parametro.put("email", email);
  10.        
  11.        
  12.         JasperPrint print = JasperFillManager.fillReport("arquivo compilado", parametro,chama sua conexao);
  13.         JasperViewer viwer = new JasperViewer(print, false);// deixa false pq se vc fechar o relatorio ele não fechará seu programa
  14.         viwer.setVisible(true);
  15.         }
  16.         catch(Exception ex){
  17.             System.out.println("Problemas com o relatório !");
  18.         }
  19.         }
  20.  
  21.  
  22. //quando for chamar o relatorio em um button
  23.  
  24.    GerarRelatorio("matricula","nome", "cpf", "email");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement