package com.gertec.G250.guiTests;

import com.gertec.G250.functions.closeDoor;
import com.gertec.G250.functions.iniConfig;
import com.gertec.G250.functions.openDoor;
import com.gertec.G250.functions.openDrawer;
import com.gertec.G250.functions.printBITMAP;
import com.gertec.G250.functions.printCouponNFCe;
import com.gertec.G250.functions.printCouponSAT;
import com.gertec.G250.functions.printCustomBarCode;
import com.gertec.G250.functions.printQRCODE;
import com.gertec.G250.functions.printText;
import com.gertec.G250.functions.returnFirmware;
import com.gertec.G250.functions.returnModel;
import com.gertec.G250.functions.returnSerialNumber;
import com.gertec.G250.functions.returnStatus;
import com.gertec.G250.functions.statusDrawer;
import com.gertec.G250.functions.trigGuill;
import gnu.io.NRSerialPort;
import java.io.IOException;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author adels
 */
public class G250_GUITest extends javax.swing.JFrame {

    
    Socket socket = null;
    NRSerialPort serialPort = null; 
    /**
     * Creates new form G250_GUITest
     */
    public G250_GUITest() {
        initComponents();
    }

    /**
     * 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.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnGroupRadioButtons = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        rbNetworkAccess = new javax.swing.JRadioButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        rbSerialAccess = new javax.swing.JRadioButton();
        tfNetworkIP = new javax.swing.JTextField();
        tfNetworkPort = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        tfSerialPort = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        btnLoadPrinterInformation = new javax.swing.JButton();
        tfModel = new javax.swing.JTextField();
        tfFirmware = new javax.swing.JTextField();
        tfSerialNumber = new javax.swing.JTextField();
        btnPrinterStatus = new javax.swing.JButton();
        tfPrinterStatus = new javax.swing.JTextField();
        btnDrawerStatus = new javax.swing.JButton();
        tfDrawerStatus = new javax.swing.JTextField();
        btnOpenDrawer = new javax.swing.JButton();
        btnSaveConfig = new javax.swing.JButton();
        btnLoadConfig = new javax.swing.JButton();
        btnOpenDoor = new javax.swing.JButton();
        btnCloseDoor = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        taText = new javax.swing.JTextArea();
        btnPrintText = new javax.swing.JButton();
        btnCutPaper = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        tfCodeBar = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        btnPrintCodeBar = new javax.swing.JButton();
        tfCodeBarType = new javax.swing.JTextField();
        tfCodeBarHeight = new javax.swing.JTextField();
        tfCodeBarWidth = new javax.swing.JTextField();
        tfCodeBarHRI = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        tfQRCode = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        tfQRCodeSize = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        TFQRCodeCorrection = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        btnPrintQRCode = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        tfImagePath = new javax.swing.JTextField();
        btnPrintBitmap = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        tfXMLPath = new javax.swing.JTextField();
        btnPrintNFCe = new javax.swing.JButton();
        btnPrintSAT = new javax.swing.JButton();
        jLabel26 = new javax.swing.JLabel();
        tfCouponType = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        btnGroupRadioButtons.add(rbNetworkAccess);
        rbNetworkAccess.setText("Via Rede");

        jLabel1.setText("IP");

        jLabel2.setText("Porta");

        btnGroupRadioButtons.add(rbSerialAccess);
        rbSerialAccess.setSelected(true);
        rbSerialAccess.setText("RS232");

        jLabel3.setText("Porta Serial");

        jLabel5.setText("Tipos de conexão");

        jLabel6.setText("Informações da impressora");

        jLabel7.setText("Modelo");

        jLabel8.setText("Firmware");

        jLabel9.setText("No. Série");

        btnLoadPrinterInformation.setText("Carregar Informações");
        btnLoadPrinterInformation.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLoadPrinterInformationActionPerformed(evt);
            }
        });

        tfModel.setEditable(false);

        tfFirmware.setEditable(false);

        tfSerialNumber.setEditable(false);

        btnPrinterStatus.setText("Status da Impressora");
        btnPrinterStatus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPrinterStatusActionPerformed(evt);
            }
        });

        tfPrinterStatus.setEditable(false);

        btnDrawerStatus.setText("Status da Gaveta");
        btnDrawerStatus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDrawerStatusActionPerformed(evt);
            }
        });

        tfDrawerStatus.setEditable(false);

        btnOpenDrawer.setText("Abrir Gaveta");
        btnOpenDrawer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOpenDrawerActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6)
                    .addComponent(btnLoadPrinterInformation)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel7)
                            .addComponent(jLabel8)
                            .addComponent(jLabel9))
                        .addGap(37, 37, 37)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(tfModel)
                            .addComponent(tfFirmware)
                            .addComponent(tfSerialNumber, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE))
                        .addGap(44, 44, 44)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnOpenDrawer)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(btnPrinterStatus)
                                    .addComponent(btnDrawerStatus))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(tfPrinterStatus, javax.swing.GroupLayout.DEFAULT_SIZE, 111, Short.MAX_VALUE)
                                    .addComponent(tfDrawerStatus))))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(tfModel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnPrinterStatus)
                    .addComponent(tfPrinterStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(tfFirmware, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnDrawerStatus)
                    .addComponent(tfDrawerStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(tfSerialNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnOpenDrawer))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addComponent(btnLoadPrinterInformation))
        );

        btnSaveConfig.setText("Gravar iniConfig");
        btnSaveConfig.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSaveConfigActionPerformed(evt);
            }
        });

        btnLoadConfig.setText("Carregar iniConfig");
        btnLoadConfig.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLoadConfigActionPerformed(evt);
            }
        });

        btnOpenDoor.setText("Abrir Porta");
        btnOpenDoor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOpenDoorActionPerformed(evt);
            }
        });

        btnCloseDoor.setText("Fechar Porta");
        btnCloseDoor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCloseDoorActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(rbNetworkAccess)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(rbSerialAccess)
                        .addGap(132, 132, 132))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                        .addComponent(jLabel2)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(tfNetworkPort))
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                        .addComponent(jLabel1)
                                        .addGap(31, 31, 31)
                                        .addComponent(tfNetworkIP, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(42, 42, 42)
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(tfSerialPort, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel5)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(btnSaveConfig, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnLoadConfig)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnOpenDoor)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(btnCloseDoor)))
                        .addGap(12, 12, 12)))
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel5)
                .addGap(9, 9, 9)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(rbNetworkAccess)
                    .addComponent(rbSerialAccess))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(tfNetworkIP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(tfSerialPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(tfNetworkPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnSaveConfig)
                    .addComponent(btnLoadConfig)
                    .addComponent(btnOpenDoor)
                    .addComponent(btnCloseDoor))
                .addContainerGap())
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        jLabel4.setText("Texto a Imprimir");

        taText.setColumns(20);
        taText.setLineWrap(true);
        taText.setRows(5);
        jScrollPane1.setViewportView(taText);

        btnPrintText.setText("Imprimir");
        btnPrintText.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPrintTextActionPerformed(evt);
            }
        });

        btnCutPaper.setText("Cortar Papel");
        btnCutPaper.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCutPaperActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(btnPrintText)
                        .addGap(28, 28, 28)
                        .addComponent(btnCutPaper))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addContainerGap(26, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnPrintText)
                    .addComponent(btnCutPaper))
                .addGap(19, 19, 19))
        );

        jLabel10.setText("Imprimir Código de barras");

        jLabel11.setText("Código");

        jLabel13.setText("Tipo de Código");

        jLabel14.setText("Altura");

        jLabel15.setText("Largura");

        jLabel16.setText("HRI");

        btnPrintCodeBar.setText("Imprimir");
        btnPrintCodeBar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPrintCodeBarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jLabel10)
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel11)
                .addGap(21, 21, 21)
                .addComponent(tfCodeBar, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(94, 94, 94))
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel13)
                        .addGap(18, 18, 18)
                        .addComponent(tfCodeBarType, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel14)
                        .addGap(18, 18, 18)
                        .addComponent(tfCodeBarHeight, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(btnPrintCodeBar)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel15)
                            .addComponent(jLabel16))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tfCodeBarHRI, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfCodeBarWidth, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jLabel10)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(tfCodeBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(tfCodeBarType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(tfCodeBarHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(tfCodeBarWidth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfCodeBarHRI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel16))
                .addGap(18, 18, 18)
                .addComponent(btnPrintCodeBar)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jLabel12.setText("Imprimir QRCode");

        jLabel17.setText("Texto do QRCode");

        jLabel18.setText("Tamanho");

        jLabel19.setText("Nível de correção");

        jLabel20.setText("48 - 51");

        jLabel21.setText("1 - 16");

        btnPrintQRCode.setText("Imprimir QRCode");
        btnPrintQRCode.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPrintQRCodeActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel12)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel17)
                            .addComponent(jLabel18)
                            .addComponent(jLabel19))
                        .addGap(28, 28, 28)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tfQRCode, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(jPanel5Layout.createSequentialGroup()
                                    .addComponent(tfQRCodeSize, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabel21))
                                .addGroup(jPanel5Layout.createSequentialGroup()
                                    .addComponent(TFQRCodeCorrection, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(57, 57, 57)
                                    .addComponent(jLabel20)))))
                    .addComponent(btnPrintQRCode))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jLabel12)
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(tfQRCode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(tfQRCodeSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel21))
                .addGap(23, 23, 23)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(TFQRCodeCorrection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel20))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btnPrintQRCode)
                .addGap(28, 28, 28))
        );

        jLabel22.setText("Imprimir Imagem");

        jLabel23.setText("Caminho da Imagem");

        btnPrintBitmap.setText("Imprimir");
        btnPrintBitmap.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPrintBitmapActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel22)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel23)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(tfImagePath, javax.swing.GroupLayout.PREFERRED_SIZE, 236, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addComponent(btnPrintBitmap)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel22)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel23)
                    .addComponent(tfImagePath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnPrintBitmap)
                .addContainerGap(22, Short.MAX_VALUE))
        );

        jLabel24.setText("Imprimir Coupon");

        jLabel25.setText("Caminho do XML");

        btnPrintNFCe.setText("Imprimir NFCe");
        btnPrintNFCe.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPrintNFCeActionPerformed(evt);
            }
        });

        btnPrintSAT.setText("Imprimir SAT");
        btnPrintSAT.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPrintSATActionPerformed(evt);
            }
        });

        jLabel26.setText("Tipo");

        tfCouponType.setText("1");

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addComponent(jLabel24)
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(btnPrintNFCe)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnPrintSAT))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel25)
                            .addComponent(jLabel26))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tfCouponType, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tfXMLPath, javax.swing.GroupLayout.PREFERRED_SIZE, 208, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(37, 37, 37))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addComponent(jLabel24)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel25)
                    .addComponent(tfXMLPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel26)
                    .addComponent(tfCouponType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnPrintSAT)
                    .addComponent(btnPrintNFCe)))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 291, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, 328, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 27, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(0, 8, Short.MAX_VALUE)
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnPrintCodeBarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrintCodeBarActionPerformed
       if(rbNetworkAccess.isSelected()&& socket != null){
           if(tfNetworkIP.getText().isEmpty()|| tfNetworkPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
                //Socket socket = openDoor.openDoor(tfNetworkIP.getText(), Integer.valueOf(tfNetworkPort.getText()));
                printCustomBarCode.printCustomBarCode(Integer.valueOf(tfCodeBarHeight.getText()), 
                        Integer.valueOf(tfCodeBarWidth.getText()), Integer.valueOf(tfCodeBarHRI.getText()), 
                        tfCodeBarType.getText(), tfCodeBar.getText(), socket);
                printText.printText(taText.getText(), socket);
                //closeDoor.closeDoor(socket);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }else if(rbSerialAccess.isSelected() && serialPort != null){
            if(tfSerialPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
                //NRSerialPort serialPort = openDoor.openDoor(tfSerialPort.getText());
                printCustomBarCode.printCustomBarCode(Integer.valueOf(tfCodeBarHeight.getText()), 
                        Integer.valueOf(tfCodeBarWidth.getText()), Integer.valueOf(tfCodeBarHRI.getText()), 
                        tfCodeBarType.getText(), tfCodeBar.getText(), serialPort);
                //closeDoor.closeDoor(serialPort);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_btnPrintCodeBarActionPerformed

    private void btnPrintTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrintTextActionPerformed
        if(rbNetworkAccess.isSelected()&& socket != null){
            if(tfNetworkIP.getText().isEmpty() || tfNetworkPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
                //Socket socket = openDoor.openDoor(tfNetworkIP.getText(), Integer.valueOf(tfNetworkPort.getText()));
                printText.printText(taText.getText(), socket);
                //closeDoor.closeDoor(socket);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }else if(rbSerialAccess.isSelected() && serialPort != null){
             if(tfSerialPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina a porta serial");
            try {
                //NRSerialPort serialPort = openDoor.openDoor(tfSerialPort.getText());
                printText.printText(taText.getText(), serialPort);
                //closeDoor.closeDoor(serialPort);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_btnPrintTextActionPerformed

    private void btnCutPaperActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCutPaperActionPerformed
        if(rbNetworkAccess.isSelected()&& socket != null){
            if(tfNetworkIP.getText().isEmpty() || tfNetworkPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
                //Socket socket = openDoor.openDoor(tfNetworkIP.getText(), Integer.valueOf(tfNetworkPort.getText()));
                trigGuill.trigGuill(socket);
                //closeDoor.closeDoor(socket);
            }catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }else if(rbSerialAccess.isSelected()&& serialPort != null){
            if(tfSerialPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina a porta serial");
            try {
                //NRSerialPort serialPort = openDoor.openDoor(tfSerialPort.getText());
                trigGuill.trigGuill(serialPort);
                //closeDoor.closeDoor(serialPort);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_btnCutPaperActionPerformed

    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        String text = "Testando texto de formatação com tags: </lf><ne>Texto Negrito</ne> & "
                    + "<su> texto sublinhado </su> além disso podemos </lf>"
                    + "<ne><ce> centralizar o texto em negrito </ce></ne></lf>"
                    + "e <c> diminuir a font </c> entre outras opções.</lf>"
                    + "<ald>Texto a Direita</ald></lf>"
                    + "<ex>Texto expandido</ex>"
                    + "<p>Texto normal </p>"
                    + "<da>Altura Dupla</da>"
                    + "<dl>largura Dupla</dl>"
                    + "<dal>Altura e largura Dupla</dal>"
                    + "<fi>Fonte invertida</fi>"
                    + "Teste de </ht> tab horizontal</lf>"
                    + "teste de código de barras</lf>"
                    + "<ce><cbar>code128,2,100,1,234565567</cbar></ce></lf>"
                    + "teste de QRCode</lf>"
                    + "<ce><qr>6,48,texto simples de qrCode via tag</qr></ce></lf>"
                    + "</gui>";
        taText.setText(text);
    }//GEN-LAST:event_formWindowOpened

    private void btnPrintQRCodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrintQRCodeActionPerformed
        if(rbNetworkAccess.isSelected()&& socket != null){
            if(tfNetworkIP.getText().isEmpty() || tfNetworkPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
                //Socket socket = openDoor.openDoor(tfNetworkIP.getText(), Integer.valueOf(tfNetworkPort.getText()));
                printQRCODE.printQRCODE(Integer.valueOf(tfQRCodeSize.getText()), 
                        Integer.valueOf(TFQRCodeCorrection.getText()), tfQRCode.getText(), socket);
                //closeDoor.closeDoor(socket);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }else if(rbSerialAccess.isSelected()){
             if(tfSerialPort.getText().isEmpty()&& serialPort != null)
               throw new IllegalArgumentException("Defina a porta serial");
            try {
                //NRSerialPort serialPort = openDoor.openDoor(tfSerialPort.getText());
                printQRCODE.printQRCODE(Integer.valueOf(tfQRCodeSize.getText()), 
                        Integer.valueOf(TFQRCodeCorrection.getText()), tfQRCode.getText(), serialPort);
                //closeDoor.closeDoor(serialPort);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_btnPrintQRCodeActionPerformed

    private void btnPrintBitmapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrintBitmapActionPerformed
        if(rbNetworkAccess.isSelected()&& socket != null){
            if(tfNetworkIP.getText().isEmpty() || tfNetworkPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
                //Socket socket = openDoor.openDoor(tfNetworkIP.getText(), Integer.valueOf(tfNetworkPort.getText()));
                printBITMAP.printBITMAP(tfImagePath.getText(), socket);
                //closeDoor.closeDoor(socket);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }else if(rbSerialAccess.isSelected()&& serialPort != null){
             if(tfSerialPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina a porta serial");
            try {
                //NRSerialPort serialPort = openDoor.openDoor(tfSerialPort.getText());
                printBITMAP.printBITMAP(tfImagePath.getText(), serialPort);
                //closeDoor.closeDoor(serialPort);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_btnPrintBitmapActionPerformed

    private void btnLoadPrinterInformationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadPrinterInformationActionPerformed
        if(rbNetworkAccess.isSelected()&& socket != null){
            if(tfNetworkIP.getText().isEmpty() || tfNetworkPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
                //Socket socket = openDoor.openDoor(tfNetworkIP.getText(), Integer.valueOf(tfNetworkPort.getText()));
                tfModel.setText(returnModel.returnModel(socket));
                tfFirmware.setText(returnFirmware.returnFirmware(socket));
                tfSerialNumber.setText(returnSerialNumber.returnSerialNumber(socket));
                //closeDoor.closeDoor(socket);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }else if(rbSerialAccess.isSelected()&& serialPort != null){
             if(tfSerialPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina a porta serial");
            try {
                //NRSerialPort serialPort = openDoor.openDoor(tfSerialPort.getText());
                tfModel.setText(returnModel.returnModel(serialPort));
                tfFirmware.setText(returnFirmware.returnFirmware(serialPort));
                tfSerialNumber.setText(returnSerialNumber.returnSerialNumber(serialPort));
                //closeDoor.closeDoor(serialPort);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_btnLoadPrinterInformationActionPerformed

    private void btnOpenDrawerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOpenDrawerActionPerformed
        if(rbNetworkAccess.isSelected()&& socket != null){
            if(tfNetworkIP.getText().isEmpty() || tfNetworkPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
                //Socket socket = openDoor.openDoor(tfNetworkIP.getText(), Integer.valueOf(tfNetworkPort.getText()));
                openDrawer.openDrawer(socket);
                //closeDoor.closeDoor(socket);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }else if(rbSerialAccess.isSelected()&& serialPort != null){
             if(tfSerialPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina a porta serial");
            try {
                //NRSerialPort serialPort = openDoor.openDoor(tfSerialPort.getText());
                openDrawer.openDrawer(serialPort);
                //closeDoor.closeDoor(serialPort);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_btnOpenDrawerActionPerformed

    private void btnPrinterStatusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrinterStatusActionPerformed
        if(rbNetworkAccess.isSelected()&& socket != null){
            if(tfNetworkIP.getText().isEmpty() || tfNetworkPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
                tfPrinterStatus.setText("");
                //Socket socket = openDoor.openDoor(tfNetworkIP.getText(), Integer.valueOf(tfNetworkPort.getText()));
                tfPrinterStatus.setText(returnStatus.returnStatus(socket));
                //closeDoor.closeDoor(socket);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }else if(rbSerialAccess.isSelected()&& serialPort != null){
             if(tfSerialPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina a porta serial");
            try {
                tfPrinterStatus.setText("");
                //NRSerialPort serialPort = openDoor.openDoor(tfSerialPort.getText());
                tfPrinterStatus.setText(returnStatus.returnStatus(serialPort));
                //closeDoor.closeDoor(serialPort);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_btnPrinterStatusActionPerformed

    private void btnSaveConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveConfigActionPerformed
        iniConfig.iniConfig(tfSerialPort.getText());
        iniConfig.iniConfig(tfNetworkIP.getText(), tfNetworkPort.getText());
    }//GEN-LAST:event_btnSaveConfigActionPerformed

    private void btnLoadConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadConfigActionPerformed
        try {
            String [] arrResponse = iniConfig.getConfig();
            if(arrResponse.length == 3){
               tfSerialPort.setText(arrResponse[0]);
               tfNetworkIP.setText(arrResponse[1]);
               tfNetworkPort.setText(arrResponse[2]);
            }
            
        } catch (IOException ex) {
            Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btnLoadConfigActionPerformed

    private void btnDrawerStatusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDrawerStatusActionPerformed
        if(rbNetworkAccess.isSelected()&& socket != null){
            if(tfNetworkIP.getText().isEmpty() || tfNetworkPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
                tfDrawerStatus.setText("");
                //Socket socket = openDoor.openDoor(tfNetworkIP.getText(), Integer.valueOf(tfNetworkPort.getText()));
                tfDrawerStatus.setText(statusDrawer.statusDrawer(socket));
                //closeDoor.closeDoor(socket);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }else if(rbSerialAccess.isSelected()&& serialPort != null){
             if(tfSerialPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
                tfDrawerStatus.setText("");
                //NRSerialPort serialPort = openDoor.openDoor(tfSerialPort.getText());
                tfDrawerStatus.setText(statusDrawer.statusDrawer(serialPort));
                //closeDoor.closeDoor(serialPort);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_btnDrawerStatusActionPerformed

    private void btnPrintNFCeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrintNFCeActionPerformed
       if(rbNetworkAccess.isSelected() && socket != null){
            if(tfNetworkIP.getText().isEmpty() || tfNetworkPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
                tfDrawerStatus.setText("");
                //Socket socket = openDoor.openDoor(tfNetworkIP.getText(), Integer.valueOf(tfNetworkPort.getText()));
                //tfXMLPath.setText("C:\\Users\\adels\\Documents\\procNFCe_edt.xml");
                printCouponNFCe.printCouponNFCe(tfXMLPath.getText(), 1,socket);
                //closeDoor.closeDoor(socket);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }else if(rbSerialAccess.isSelected()&& serialPort != null){
             if(tfSerialPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
                tfDrawerStatus.setText("");
                //NRSerialPort serialPort = openDoor.openDoor(tfSerialPort.getText());
                //tfXMLPath.setText("C:\\Users\\adels\\Documents\\procNFCe_edt.xml");
                printCouponNFCe.printCouponNFCe(tfXMLPath.getText(), 1, serialPort);
                //closeDoor.closeDoor(serialPort);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_btnPrintNFCeActionPerformed

    private void btnPrintSATActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrintSATActionPerformed
        if(rbNetworkAccess.isSelected() && socket != null){
            if(tfNetworkIP.getText().isEmpty() || tfNetworkPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
                tfDrawerStatus.setText("");
                //Socket socket = openDoor.openDoor(tfNetworkIP.getText(), Integer.valueOf(tfNetworkPort.getText()));
                //tfXMLPath.setText("C:\\Users\\adels\\Documents\\XMLSATRetorno.xml");
                printCouponSAT.printCouponSAT(tfXMLPath.getText(), Integer.valueOf(tfCouponType.getText()),
                        socket);
                //closeDoor.closeDoor(socket);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }else if(rbSerialAccess.isSelected()&& serialPort != null){
             if(tfSerialPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina a porta serial");
            try {
                tfDrawerStatus.setText("");
                //NRSerialPort serialPort = openDoor.openDoor(tfSerialPort.getText());
                //tfXMLPath.setText("C:\\Users\\adels\\Documents\\XMLSATRetorno.xml");
                printCouponSAT.printCouponSAT(tfXMLPath.getText(), Integer.valueOf(tfCouponType.getText()),
                        serialPort);
                //closeDoor.closeDoor(serialPort);
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_btnPrintSATActionPerformed

    private void btnOpenDoorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOpenDoorActionPerformed
       if(rbNetworkAccess.isSelected() && socket == null){
            if(tfNetworkIP.getText().isEmpty() || tfNetworkPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
                socket = openDoor.openDoor(tfNetworkIP.getText(), Integer.valueOf(tfNetworkPort.getText()));
                JOptionPane.showMessageDialog(this, "Porta de rede aberta");
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }else if(rbSerialAccess.isSelected() && serialPort == null){
             if(tfSerialPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina a porta serial");
            try {
                serialPort = openDoor.openDoor(tfSerialPort.getText());
                JOptionPane.showMessageDialog(this, "Porta de serial aberta");
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_btnOpenDoorActionPerformed

    private void btnCloseDoorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseDoorActionPerformed
       if(rbNetworkAccess.isSelected() && socket != null){
            if(tfNetworkIP.getText().isEmpty() || tfNetworkPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina o IP e a porta de rede");
            try {
         
                closeDoor.closeDoor(socket);
                JOptionPane.showMessageDialog(this, "Porta de rede fechada");
                socket = null;
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }else if(rbSerialAccess.isSelected() && serialPort != null){
             if(tfSerialPort.getText().isEmpty())
               throw new IllegalArgumentException("Defina a porta serial");
            try {
                closeDoor.closeDoor(serialPort);
                JOptionPane.showMessageDialog(this, "Porta de serial fechada");
                serialPort = null;
            } catch (IOException ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            } catch (Exception ex) {
                Logger.getLogger(G250_GUITest.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_btnCloseDoorActionPerformed

    /**
     * @param args the command line arguments
     */
    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(G250_GUITest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(G250_GUITest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(G250_GUITest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(G250_GUITest.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 G250_GUITest().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField TFQRCodeCorrection;
    private javax.swing.JButton btnCloseDoor;
    private javax.swing.JButton btnCutPaper;
    private javax.swing.JButton btnDrawerStatus;
    private javax.swing.ButtonGroup btnGroupRadioButtons;
    private javax.swing.JButton btnLoadConfig;
    private javax.swing.JButton btnLoadPrinterInformation;
    private javax.swing.JButton btnOpenDoor;
    private javax.swing.JButton btnOpenDrawer;
    private javax.swing.JButton btnPrintBitmap;
    private javax.swing.JButton btnPrintCodeBar;
    private javax.swing.JButton btnPrintNFCe;
    private javax.swing.JButton btnPrintQRCode;
    private javax.swing.JButton btnPrintSAT;
    private javax.swing.JButton btnPrintText;
    private javax.swing.JButton btnPrinterStatus;
    private javax.swing.JButton btnSaveConfig;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JRadioButton rbNetworkAccess;
    private javax.swing.JRadioButton rbSerialAccess;
    private javax.swing.JTextArea taText;
    private javax.swing.JTextField tfCodeBar;
    private javax.swing.JTextField tfCodeBarHRI;
    private javax.swing.JTextField tfCodeBarHeight;
    private javax.swing.JTextField tfCodeBarType;
    private javax.swing.JTextField tfCodeBarWidth;
    private javax.swing.JTextField tfCouponType;
    private javax.swing.JTextField tfDrawerStatus;
    private javax.swing.JTextField tfFirmware;
    private javax.swing.JTextField tfImagePath;
    private javax.swing.JTextField tfModel;
    private javax.swing.JTextField tfNetworkIP;
    private javax.swing.JTextField tfNetworkPort;
    private javax.swing.JTextField tfPrinterStatus;
    private javax.swing.JTextField tfQRCode;
    private javax.swing.JTextField tfQRCodeSize;
    private javax.swing.JTextField tfSerialNumber;
    private javax.swing.JTextField tfSerialPort;
    private javax.swing.JTextField tfXMLPath;
    // End of variables declaration//GEN-END:variables
}
