1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
| package ireport;
import java.io.File;
import java.io.FileInputStream;
import static java.lang.Compiler.command;
import java.util.HashMap;
import javax.swing.JOptionPane;
import net.sf.jasperreports.engine.JREmptyDataSource;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.view.JasperViewer;
public class inicio extends javax.swing.JFrame {
public inicio() {
initComponents();
}
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jButton1 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(null);
jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1);
jButton1.setBounds(10, 250, 73, 23);
jLabel1.setText("tommy");
getContentPane().add(jLabel1);
jLabel1.setBounds(20, 10, 90, 30);
jLabel2.setText("jLabel2");
getContentPane().add(jLabel2);
jLabel2.setBounds(20, 60, 90, 30);
jLabel3.setText("jLabel3");
getContentPane().add(jLabel3);
jLabel3.setBounds(20, 100, 90, 30);
jTextField1.setText("KUVD");
getContentPane().add(jTextField1);
jTextField1.setBounds(130, 10, 110, 30);
jTextField2.setText("FJK");
jTextField2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField2ActionPerformed(evt);
}
});
getContentPane().add(jTextField2);
jTextField2.setBounds(130, 60, 110, 30);
jTextField3.setText("TOMMY");
getContentPane().add(jTextField3);
jTextField3.setBounds(130, 110, 110, 30);
jLabel4.setText("jgdmhfm");
getContentPane().add(jLabel4);
jLabel4.setBounds(20, 150, 100, 30);
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
Lanzar_Notas();
}
private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {
}
/**
* @param args the command line arguments
*/
/* Set the Nimbus look and feel */
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new inicio().setVisible(true);
}
});
}
public void Lanzar_Notas(){
try{
Object [] option = {"Aceptez","Anuller"};
int selection = JOptionPane.showOptionDialog(null,
"tu es sur","deca",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,null,option,"acpetez");
if (selection == JOptionPane.YES_NO_CANCEL_OPTION){
String master = System.getProperty("user.dir")+ "/Reportes/report2.jasper";
HashMap parameter = new HashMap();
parameter.put("NOME", jLabel1.getText());
parameter.put("QUAN", jLabel2.getText());
parameter.put("PRIX", jTextField3.getText());
parameter.put("TOTAL", jTextField3.getText());
JasperPrint informe = JasperFillManager.fillReport(master, parameter, new JREmptyDataSource());
JasperViewer.viewReport(informe, false);
}else{
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error General Nota reorte" +e.getMessage(). toString());
}
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
// End of variables declaration
} |
Partager