* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates * and open the template in the editor. */ package ventanas; import com.barcodelib.barcode.QRCode; //import java.awt.ComponentOrientation; import java.awt.Desktop; import java.awt.Image; import java.awt.Toolkit; import java.io.File; import javax.swing.JOptionPane; //import javax.swing.ImageIcon; /** * *@author NAVEGATI */ public class ven extends javax.swing.JFrame { /** * Creates new form ven */ int udm=0;//medida en pixeles int resol= 72; float mi=0.000f;//Margen izq float md=0.000f; //Margen derecho float ms=0.000f;// Margen Superio float min=0.00f; //Margen Inferior int rot= 0; //Grado de rotacion del codigo float tam= 5.000f; //Tamano de la imagen
//ImageIcon Imagen[]= new ImageIcon[1]; public ven() { initComponents(); //ventana en el medio
//Imagen[0]= new ImageIcon(getClass().getResource(archiv));
this.setLocationRelativeTo(null); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. *@return */
// TODO add your handling code here: String texto= jTextField1.getText(); if (texto.equals("")==false){ //bloque de verdad
try { QRCode cod =new QRCode(); // se crea el objeto cod //Se envia a la informacion del text box a la variable
cod.setData(texto);// se asigna con el metodo al objeto el texto cod.setDataMode(QRCode.MODE_BYTE);//tipo de texto a codificar ; ModeNume ric, Auto , custumer etc cod.setUOM(udm); cod.setLeftMargin(mi); cod.setResolution(resol); cod.setRightMargin(md); cod.setTopMargin(ms); cod.setBottomMargin(min); cod.setRotate(rot); cod.setModuleSize(tam); String archiv= System.getProperty("user.home")+"/GENCOD.gif";
cod.renderBarcode(archiv); //enviamos el archivo //JOptionPane.showMessageDialog(null,archiv,"GENCOD",1); // icon.SetIcon(imagen[1]);
Desktop d = Desktop.getDesktop(); d.open(new File(archiv) );