package ufradvanced;

import com.sun.jna.ptr.ByteByReference;
import javax.swing.JOptionPane;

public class frmLinearFormatCard extends javax.swing.JInternalFrame {

    public frmLinearFormatCard() {
        initComponents();
    }
    
    static final int 
         FUNCT_LIGHT_OK     = 4,
         FUNCT_SOUND_OK     = 0,//4 Tripple sound
         FUNCT_LIGHT_ERROR  = 2,
         FUNCT_SOUND_ERROR  = 0,//2 Long sound
         DL_OK              = 0;
    
    static final byte
         MIFARE_AUTHENT1A   = 0x60,  
         MIFARE_AUTHENT1B   = 0x61,
         MAX_BLOCK_BYTES    = 16;
    
    private static final String ANY_DATA           = "You must enter any data !",
                                APPROPRIATE_FORMAT = "You must enter the appropriate format !";

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btngAUTH1AB = new javax.swing.ButtonGroup();
        pnlHeader = new javax.swing.JPanel();
        rbAUTH1A = new javax.swing.JRadioButton();
        rbAUTH1B = new javax.swing.JRadioButton();
        lblKeyIndex = new javax.swing.JLabel();
        cboKeyIndex = new javax.swing.JComboBox();
        lblPK = new javax.swing.JLabel();
        pnlKeyAB = new javax.swing.JPanel();
        pnlKeyA = new javax.swing.JPanel();
        lblKeyA = new javax.swing.JLabel();
        chkHexKeyA = new javax.swing.JCheckBox();
        pnlKeyB = new javax.swing.JPanel();
        lblKeyB = new javax.swing.JLabel();
        chkHexKeyB = new javax.swing.JCheckBox();
        pgLinearFormatCard = new javax.swing.JTabbedPane();
        tabLinearFormatCard = new javax.swing.JPanel();
        cboBlockAccessBits = new javax.swing.JComboBox();
        cboSectorTrailerAccessBits = new javax.swing.JComboBox();
        txtSectorTrailerByte9 = new javax.swing.JTextField();
        btnLinearFormatCard = new javax.swing.JButton();
        lblBlockAccessBits = new javax.swing.JLabel();
        lblSectorTrailerAccessBits = new javax.swing.JLabel();
        lblSectorTrailerByte9 = new javax.swing.JLabel();
        lblSectorFormatted = new javax.swing.JLabel();
        txtSectorFormatted = new javax.swing.JTextField();
        tabLinearFormatCardAKM1 = new javax.swing.JPanel();
        lblBlockAccessBitsAKM1 = new javax.swing.JLabel();
        cboBlockAccessBitsAKM1 = new javax.swing.JComboBox();
        lblSectorTrailerAccessBitsAKM1 = new javax.swing.JLabel();
        cboSectorTrailerAccessBitsAKM1 = new javax.swing.JComboBox();
        lblSectorTrailerByte9AKM1 = new javax.swing.JLabel();
        txtSectorTrailerByte9AKM1 = new javax.swing.JTextField();
        btnLinearFormatCardAKM1 = new javax.swing.JButton();
        lblSectorFormattedAKM1 = new javax.swing.JLabel();
        txtSectorFormattedAKM1 = new javax.swing.JTextField();
        tabLinearFormatCardAKM2 = new javax.swing.JPanel();
        lblBlockAccessBitsAKM2 = new javax.swing.JLabel();
        cboBlockAccessBitsAKM2 = new javax.swing.JComboBox();
        lblSectorTrailerAccessBitsAKM2 = new javax.swing.JLabel();
        cboSectorTrailerAccessBitsAKM2 = new javax.swing.JComboBox();
        lblSectorTrailerByte9AKM2 = new javax.swing.JLabel();
        txtSectorTrailerByte9AKM2 = new javax.swing.JTextField();
        btnLinearFormatCardAKM2 = new javax.swing.JButton();
        lblSectorFormattedAKM2 = new javax.swing.JLabel();
        txtSectorFormattedAKM2 = new javax.swing.JTextField();
        tabLinearFormatCardPK = new javax.swing.JPanel();
        lblBlockAccessBitsPK = new javax.swing.JLabel();
        cboBlockAccessBitsPK = new javax.swing.JComboBox();
        lblSectorTrailerAccessBitsPK = new javax.swing.JLabel();
        cboSectorTrailerAccessBitsPK = new javax.swing.JComboBox();
        lblSectorTrailerByte9PK = new javax.swing.JLabel();
        txtSectorTrailerByte9PK = new javax.swing.JTextField();
        btnLinearFormatCardPK = new javax.swing.JButton();
        lblSectorFormattedPK = new javax.swing.JLabel();
        txtSectorFormattedPK = new javax.swing.JTextField();
        lblFunction = new javax.swing.JTextField();
        txtFErrorCode = new javax.swing.JTextField();
        txtFErrorExplain = new javax.swing.JTextField();

        setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        setTitle("frmLinearFormatCard");
        setName("frmLinearFormatCard"); // NOI18N
        setPreferredSize(new java.awt.Dimension(555, 385));
        addInternalFrameListener(new javax.swing.event.InternalFrameListener() {
            public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) {
                formInternalFrameActivated(evt);
            }
            public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
            }
        });

        pnlHeader.setBackground(new java.awt.Color(255, 255, 255));
        pnlHeader.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        rbAUTH1A.setBackground(new java.awt.Color(255, 255, 255));
        btngAUTH1AB.add(rbAUTH1A);
        rbAUTH1A.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        rbAUTH1A.setSelected(true);
        rbAUTH1A.setText("AUTH 1A");
        rbAUTH1A.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

        rbAUTH1B.setBackground(new java.awt.Color(255, 255, 255));
        btngAUTH1AB.add(rbAUTH1B);
        rbAUTH1B.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        rbAUTH1B.setText("AUTH 1B");
        rbAUTH1B.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

        lblKeyIndex.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblKeyIndex.setText("Key Index");

        cboKeyIndex.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "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" }));
        cboKeyIndex.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

        lblPK.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblPK.setText("PK");

        javax.swing.GroupLayout pnlHeaderLayout = new javax.swing.GroupLayout(pnlHeader);
        pnlHeader.setLayout(pnlHeaderLayout);
        pnlHeaderLayout.setHorizontalGroup(
            pnlHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlHeaderLayout.createSequentialGroup()
                .addGap(4, 4, 4)
                .addComponent(rbAUTH1A)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbAUTH1B)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblKeyIndex)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cboKeyIndex, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblPK)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pnlHeaderLayout.setVerticalGroup(
            pnlHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(rbAUTH1A)
                .addComponent(rbAUTH1B)
                .addComponent(lblKeyIndex)
                .addComponent(cboKeyIndex, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lblPK))
        );

        pnlKeyA.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        pnlKeyA.setPreferredSize(new java.awt.Dimension(276, 116));

        lblKeyA.setBackground(new java.awt.Color(204, 204, 204));
        lblKeyA.setFont(new java.awt.Font("Verdana", 1, 11)); // NOI18N
        lblKeyA.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblKeyA.setText("KEY A");
        lblKeyA.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        lblKeyA.setOpaque(true);

        chkHexKeyA.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        chkHexKeyA.setText("Hex");
        chkHexKeyA.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        chkHexKeyA.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                chkHexKeyAItemStateChanged(evt);
            }
        });

        javax.swing.GroupLayout pnlKeyALayout = new javax.swing.GroupLayout(pnlKeyA);
        pnlKeyA.setLayout(pnlKeyALayout);
        pnlKeyALayout.setHorizontalGroup(
            pnlKeyALayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lblKeyA, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE)
            .addGroup(pnlKeyALayout.createSequentialGroup()
                .addGap(43, 43, 43)
                .addComponent(chkHexKeyA)
                .addContainerGap(184, Short.MAX_VALUE))
        );
        pnlKeyALayout.setVerticalGroup(
            pnlKeyALayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlKeyALayout.createSequentialGroup()
                .addComponent(lblKeyA, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE)
                .addComponent(chkHexKeyA)
                .addContainerGap())
        );

        pnlKeyB.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        pnlKeyB.setPreferredSize(new java.awt.Dimension(276, 116));

        lblKeyB.setBackground(new java.awt.Color(204, 204, 204));
        lblKeyB.setFont(new java.awt.Font("Verdana", 1, 11)); // NOI18N
        lblKeyB.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblKeyB.setText("KEY B");
        lblKeyB.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        lblKeyB.setOpaque(true);

        chkHexKeyB.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        chkHexKeyB.setText("Hex");
        chkHexKeyB.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        chkHexKeyB.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                chkHexKeyBItemStateChanged(evt);
            }
        });

        javax.swing.GroupLayout pnlKeyBLayout = new javax.swing.GroupLayout(pnlKeyB);
        pnlKeyB.setLayout(pnlKeyBLayout);
        pnlKeyBLayout.setHorizontalGroup(
            pnlKeyBLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lblKeyB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(pnlKeyBLayout.createSequentialGroup()
                .addGap(41, 41, 41)
                .addComponent(chkHexKeyB)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pnlKeyBLayout.setVerticalGroup(
            pnlKeyBLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlKeyBLayout.createSequentialGroup()
                .addComponent(lblKeyB, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE)
                .addComponent(chkHexKeyB)
                .addContainerGap())
        );

        javax.swing.GroupLayout pnlKeyABLayout = new javax.swing.GroupLayout(pnlKeyAB);
        pnlKeyAB.setLayout(pnlKeyABLayout);
        pnlKeyABLayout.setHorizontalGroup(
            pnlKeyABLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlKeyABLayout.createSequentialGroup()
                .addComponent(pnlKeyA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pnlKeyB, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE))
        );
        pnlKeyABLayout.setVerticalGroup(
            pnlKeyABLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pnlKeyA, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)
            .addComponent(pnlKeyB, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)
        );

        pgLinearFormatCard.setFont(new java.awt.Font("Verdana", 1, 11)); // NOI18N

        cboBlockAccessBits.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        cboBlockAccessBits.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" }));
        cboBlockAccessBits.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

        cboSectorTrailerAccessBits.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        cboSectorTrailerAccessBits.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" }));
        cboSectorTrailerAccessBits.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

        txtSectorTrailerByte9.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        txtSectorTrailerByte9.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtSectorTrailerByte9.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        btnLinearFormatCard.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        btnLinearFormatCard.setText("FORMAT");
        btnLinearFormatCard.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnLinearFormatCard.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLinearFormatCardActionPerformed(evt);
            }
        });

        lblBlockAccessBits.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblBlockAccessBits.setText("Block Access Bits");

        lblSectorTrailerAccessBits.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblSectorTrailerAccessBits.setText("Sector Trailer Access Bits");

        lblSectorTrailerByte9.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblSectorTrailerByte9.setText("Sector Trailer Byte 9");

        lblSectorFormatted.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblSectorFormatted.setText("Sector Formatted");

        txtSectorFormatted.setEditable(false);
        txtSectorFormatted.setBackground(new java.awt.Color(204, 204, 204));
        txtSectorFormatted.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        txtSectorFormatted.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtSectorFormatted.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout tabLinearFormatCardLayout = new javax.swing.GroupLayout(tabLinearFormatCard);
        tabLinearFormatCard.setLayout(tabLinearFormatCardLayout);
        tabLinearFormatCardLayout.setHorizontalGroup(
            tabLinearFormatCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabLinearFormatCardLayout.createSequentialGroup()
                .addGap(87, 87, 87)
                .addGroup(tabLinearFormatCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabLinearFormatCardLayout.createSequentialGroup()
                        .addGroup(tabLinearFormatCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblSectorTrailerAccessBits)
                            .addComponent(lblBlockAccessBits))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(tabLinearFormatCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtSectorTrailerByte9)
                            .addComponent(cboSectorTrailerAccessBits, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(cboBlockAccessBits, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(lblSectorTrailerByte9))
                .addGap(27, 27, 27)
                .addGroup(tabLinearFormatCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(tabLinearFormatCardLayout.createSequentialGroup()
                        .addComponent(lblSectorFormatted)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(txtSectorFormatted, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(btnLinearFormatCard, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(58, 58, 58))
        );
        tabLinearFormatCardLayout.setVerticalGroup(
            tabLinearFormatCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabLinearFormatCardLayout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addGroup(tabLinearFormatCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabLinearFormatCardLayout.createSequentialGroup()
                        .addGroup(tabLinearFormatCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cboBlockAccessBits, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblBlockAccessBits))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(tabLinearFormatCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cboSectorTrailerAccessBits, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSectorTrailerAccessBits))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(tabLinearFormatCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtSectorTrailerByte9, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSectorTrailerByte9)))
                    .addGroup(tabLinearFormatCardLayout.createSequentialGroup()
                        .addComponent(btnLinearFormatCard, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(tabLinearFormatCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtSectorFormatted, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSectorFormatted))))
                .addContainerGap(40, Short.MAX_VALUE))
        );

        pgLinearFormatCard.addTab("Linear Format", tabLinearFormatCard);

        lblBlockAccessBitsAKM1.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblBlockAccessBitsAKM1.setText("Block Access Bits");

        cboBlockAccessBitsAKM1.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        cboBlockAccessBitsAKM1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" }));
        cboBlockAccessBitsAKM1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

        lblSectorTrailerAccessBitsAKM1.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblSectorTrailerAccessBitsAKM1.setText("Sector Trailer Access Bits");

        cboSectorTrailerAccessBitsAKM1.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        cboSectorTrailerAccessBitsAKM1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" }));
        cboSectorTrailerAccessBitsAKM1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

        lblSectorTrailerByte9AKM1.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblSectorTrailerByte9AKM1.setText("Sector Trailer Byte 9");

        txtSectorTrailerByte9AKM1.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        txtSectorTrailerByte9AKM1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtSectorTrailerByte9AKM1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        btnLinearFormatCardAKM1.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        btnLinearFormatCardAKM1.setText("FORMAT");
        btnLinearFormatCardAKM1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnLinearFormatCardAKM1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLinearFormatCardAKM1ActionPerformed(evt);
            }
        });

        lblSectorFormattedAKM1.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblSectorFormattedAKM1.setText("Sector Formatted");

        txtSectorFormattedAKM1.setEditable(false);
        txtSectorFormattedAKM1.setBackground(new java.awt.Color(204, 204, 204));
        txtSectorFormattedAKM1.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        txtSectorFormattedAKM1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtSectorFormattedAKM1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout tabLinearFormatCardAKM1Layout = new javax.swing.GroupLayout(tabLinearFormatCardAKM1);
        tabLinearFormatCardAKM1.setLayout(tabLinearFormatCardAKM1Layout);
        tabLinearFormatCardAKM1Layout.setHorizontalGroup(
            tabLinearFormatCardAKM1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabLinearFormatCardAKM1Layout.createSequentialGroup()
                .addGap(87, 87, 87)
                .addGroup(tabLinearFormatCardAKM1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabLinearFormatCardAKM1Layout.createSequentialGroup()
                        .addGroup(tabLinearFormatCardAKM1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblSectorTrailerAccessBitsAKM1)
                            .addComponent(lblBlockAccessBitsAKM1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(tabLinearFormatCardAKM1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtSectorTrailerByte9AKM1)
                            .addComponent(cboSectorTrailerAccessBitsAKM1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(cboBlockAccessBitsAKM1, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(lblSectorTrailerByte9AKM1))
                .addGap(27, 27, 27)
                .addGroup(tabLinearFormatCardAKM1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(tabLinearFormatCardAKM1Layout.createSequentialGroup()
                        .addComponent(lblSectorFormattedAKM1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(txtSectorFormattedAKM1, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(btnLinearFormatCardAKM1, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(58, 58, 58))
        );
        tabLinearFormatCardAKM1Layout.setVerticalGroup(
            tabLinearFormatCardAKM1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabLinearFormatCardAKM1Layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addGroup(tabLinearFormatCardAKM1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabLinearFormatCardAKM1Layout.createSequentialGroup()
                        .addGroup(tabLinearFormatCardAKM1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cboBlockAccessBitsAKM1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblBlockAccessBitsAKM1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(tabLinearFormatCardAKM1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cboSectorTrailerAccessBitsAKM1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSectorTrailerAccessBitsAKM1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(tabLinearFormatCardAKM1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtSectorTrailerByte9AKM1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSectorTrailerByte9AKM1)))
                    .addGroup(tabLinearFormatCardAKM1Layout.createSequentialGroup()
                        .addComponent(btnLinearFormatCardAKM1, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(tabLinearFormatCardAKM1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtSectorFormattedAKM1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSectorFormattedAKM1))))
                .addContainerGap(40, Short.MAX_VALUE))
        );

        pgLinearFormatCard.addTab("LinearFormat AKM1", tabLinearFormatCardAKM1);

        lblBlockAccessBitsAKM2.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblBlockAccessBitsAKM2.setText("Block Access Bits");

        cboBlockAccessBitsAKM2.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        cboBlockAccessBitsAKM2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" }));
        cboBlockAccessBitsAKM2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

        lblSectorTrailerAccessBitsAKM2.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblSectorTrailerAccessBitsAKM2.setText("Sector Trailer Access Bits");

        cboSectorTrailerAccessBitsAKM2.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        cboSectorTrailerAccessBitsAKM2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" }));
        cboSectorTrailerAccessBitsAKM2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

        lblSectorTrailerByte9AKM2.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblSectorTrailerByte9AKM2.setText("Sector Trailer Byte 9");

        txtSectorTrailerByte9AKM2.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        txtSectorTrailerByte9AKM2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtSectorTrailerByte9AKM2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        btnLinearFormatCardAKM2.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        btnLinearFormatCardAKM2.setText("FORMAT");
        btnLinearFormatCardAKM2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnLinearFormatCardAKM2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLinearFormatCardAKM2ActionPerformed(evt);
            }
        });

        lblSectorFormattedAKM2.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblSectorFormattedAKM2.setText("Sector Formatted");

        txtSectorFormattedAKM2.setEditable(false);
        txtSectorFormattedAKM2.setBackground(new java.awt.Color(204, 204, 204));
        txtSectorFormattedAKM2.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        txtSectorFormattedAKM2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtSectorFormattedAKM2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout tabLinearFormatCardAKM2Layout = new javax.swing.GroupLayout(tabLinearFormatCardAKM2);
        tabLinearFormatCardAKM2.setLayout(tabLinearFormatCardAKM2Layout);
        tabLinearFormatCardAKM2Layout.setHorizontalGroup(
            tabLinearFormatCardAKM2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabLinearFormatCardAKM2Layout.createSequentialGroup()
                .addGap(87, 87, 87)
                .addGroup(tabLinearFormatCardAKM2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabLinearFormatCardAKM2Layout.createSequentialGroup()
                        .addGroup(tabLinearFormatCardAKM2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblSectorTrailerAccessBitsAKM2)
                            .addComponent(lblBlockAccessBitsAKM2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(tabLinearFormatCardAKM2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtSectorTrailerByte9AKM2)
                            .addComponent(cboSectorTrailerAccessBitsAKM2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(cboBlockAccessBitsAKM2, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(lblSectorTrailerByte9AKM2))
                .addGap(27, 27, 27)
                .addGroup(tabLinearFormatCardAKM2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(tabLinearFormatCardAKM2Layout.createSequentialGroup()
                        .addComponent(lblSectorFormattedAKM2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(txtSectorFormattedAKM2, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(btnLinearFormatCardAKM2, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(58, 58, 58))
        );
        tabLinearFormatCardAKM2Layout.setVerticalGroup(
            tabLinearFormatCardAKM2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabLinearFormatCardAKM2Layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addGroup(tabLinearFormatCardAKM2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabLinearFormatCardAKM2Layout.createSequentialGroup()
                        .addGroup(tabLinearFormatCardAKM2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cboBlockAccessBitsAKM2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblBlockAccessBitsAKM2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(tabLinearFormatCardAKM2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cboSectorTrailerAccessBitsAKM2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSectorTrailerAccessBitsAKM2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(tabLinearFormatCardAKM2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtSectorTrailerByte9AKM2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSectorTrailerByte9AKM2)))
                    .addGroup(tabLinearFormatCardAKM2Layout.createSequentialGroup()
                        .addComponent(btnLinearFormatCardAKM2, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(tabLinearFormatCardAKM2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtSectorFormattedAKM2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSectorFormattedAKM2))))
                .addContainerGap(40, Short.MAX_VALUE))
        );

        pgLinearFormatCard.addTab("LinearFormat AKM2", tabLinearFormatCardAKM2);

        lblBlockAccessBitsPK.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblBlockAccessBitsPK.setText("Block Access Bits");

        cboBlockAccessBitsPK.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        cboBlockAccessBitsPK.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" }));
        cboBlockAccessBitsPK.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

        lblSectorTrailerAccessBitsPK.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblSectorTrailerAccessBitsPK.setText("Sector Trailer Access Bits");

        cboSectorTrailerAccessBitsPK.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        cboSectorTrailerAccessBitsPK.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7" }));
        cboSectorTrailerAccessBitsPK.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

        lblSectorTrailerByte9PK.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblSectorTrailerByte9PK.setText("Sector Trailer Byte 9");

        txtSectorTrailerByte9PK.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        txtSectorTrailerByte9PK.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtSectorTrailerByte9PK.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        btnLinearFormatCardPK.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        btnLinearFormatCardPK.setText("FORMAT");
        btnLinearFormatCardPK.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        btnLinearFormatCardPK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLinearFormatCardPKActionPerformed(evt);
            }
        });

        lblSectorFormattedPK.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblSectorFormattedPK.setText("Sector Formatted");

        txtSectorFormattedPK.setEditable(false);
        txtSectorFormattedPK.setBackground(new java.awt.Color(204, 204, 204));
        txtSectorFormattedPK.setFont(new java.awt.Font("Verdana", 1, 12)); // NOI18N
        txtSectorFormattedPK.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtSectorFormattedPK.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        javax.swing.GroupLayout tabLinearFormatCardPKLayout = new javax.swing.GroupLayout(tabLinearFormatCardPK);
        tabLinearFormatCardPK.setLayout(tabLinearFormatCardPKLayout);
        tabLinearFormatCardPKLayout.setHorizontalGroup(
            tabLinearFormatCardPKLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabLinearFormatCardPKLayout.createSequentialGroup()
                .addGap(87, 87, 87)
                .addGroup(tabLinearFormatCardPKLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabLinearFormatCardPKLayout.createSequentialGroup()
                        .addGroup(tabLinearFormatCardPKLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblSectorTrailerAccessBitsPK)
                            .addComponent(lblBlockAccessBitsPK))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(tabLinearFormatCardPKLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtSectorTrailerByte9PK)
                            .addComponent(cboSectorTrailerAccessBitsPK, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(cboBlockAccessBitsPK, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(lblSectorTrailerByte9PK))
                .addGap(27, 27, 27)
                .addGroup(tabLinearFormatCardPKLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(tabLinearFormatCardPKLayout.createSequentialGroup()
                        .addComponent(lblSectorFormattedPK)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(txtSectorFormattedPK, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(btnLinearFormatCardPK, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(58, 58, 58))
        );
        tabLinearFormatCardPKLayout.setVerticalGroup(
            tabLinearFormatCardPKLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabLinearFormatCardPKLayout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addGroup(tabLinearFormatCardPKLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabLinearFormatCardPKLayout.createSequentialGroup()
                        .addGroup(tabLinearFormatCardPKLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cboBlockAccessBitsPK, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblBlockAccessBitsPK))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(tabLinearFormatCardPKLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cboSectorTrailerAccessBitsPK, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSectorTrailerAccessBitsPK))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(tabLinearFormatCardPKLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtSectorTrailerByte9PK, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSectorTrailerByte9PK)))
                    .addGroup(tabLinearFormatCardPKLayout.createSequentialGroup()
                        .addComponent(btnLinearFormatCardPK, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(tabLinearFormatCardPKLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtSectorFormattedPK, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblSectorFormattedPK))))
                .addContainerGap(40, Short.MAX_VALUE))
        );

        pgLinearFormatCard.addTab("LinearFormat PK", tabLinearFormatCardPK);

        lblFunction.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        lblFunction.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        lblFunction.setText("Function Error");

        txtFErrorCode.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        txtFErrorCode.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtFErrorCode.setText(" ");

        txtFErrorExplain.setFont(new java.awt.Font("Verdana", 0, 11)); // NOI18N
        txtFErrorExplain.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtFErrorExplain.setText(" ");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pnlHeader, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(pnlKeyAB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(pgLinearFormatCard, 0, 0, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addComponent(lblFunction, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(txtFErrorCode, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(txtFErrorExplain, javax.swing.GroupLayout.PREFERRED_SIZE, 340, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(pnlHeader, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pnlKeyAB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pgLinearFormatCard)
                .addGap(7, 7, 7)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblFunction, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtFErrorCode, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtFErrorExplain, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

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

   
    
    private void formInternalFrameActivated(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameActivated
        new Global().CreateKey(312, 5, 31, 29, "txtPKKey", pnlHeader);
        new Global().CreateKey(45, 45, 31, 29, "txtLinearKeyA", pnlKeyA);
        new Global().CreateKey(45, 45, 31, 29, "txtLinearKeyB", pnlKeyB);
    }//GEN-LAST:event_formInternalFrameActivated

    private void chkHexKeyAItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_chkHexKeyAItemStateChanged
        new Global().Check_box(pnlKeyA, "txtLinearKeyA", evt);
        new Global().HEX_BOX = chkHexKeyA;
        new Global().TEXTFIELD="txtLinearKeyA";
    }//GEN-LAST:event_chkHexKeyAItemStateChanged

    private void chkHexKeyBItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_chkHexKeyBItemStateChanged
        new Global().Check_box(pnlKeyB, "txtLinearKeyB", evt);
        new Global().HEX_BOX = chkHexKeyB;
        new Global().TEXTFIELD="txtLinearKeyB";
    }//GEN-LAST:event_chkHexKeyBItemStateChanged

    private void btnLinearFormatCardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLinearFormatCardActionPerformed
        frmMain M = new frmMain();
        if (M.GetFunct() || M.GetLoop()) {
            return;
        }
        try
        {
          M.SetFunct(true);
          int iFResult               = 0;
          byte auth_mode             = (rbAUTH1A.isSelected() ? MIFARE_AUTHENT1A : MIFARE_AUTHENT1B);                                        
          byte key_index             = (byte) cboKeyIndex.getSelectedIndex() ;       
          byte block_access_bits     = 0;
          byte sector_access_bits    = 0;
          byte sector_trailers_byte9 = 0;
          
          ByteByReference sector_formatted = new ByteByReference();
        
            if (txtSectorTrailerByte9.getText().trim().isEmpty()) {
                JOptionPane.showMessageDialog(rootPane, "You must enter the  SECTOR TRAILER BYTE 9", "Warning", JOptionPane.WARNING_MESSAGE);
                txtSectorTrailerByte9.requestFocus();
                return;
            }
            txtSectorFormatted.setText("");
            
            block_access_bits     = (byte) cboBlockAccessBits.getSelectedIndex();
            sector_access_bits    = (byte) cboSectorTrailerAccessBits.getSelectedIndex();
            sector_trailers_byte9 = Byte.parseByte(txtSectorTrailerByte9.getText());

            iFResult = Declarations.UFrDeclarations.UFRInstance.LinearFormatCard(new Global().KEY(pnlKeyA, "txtLinearKeyA", chkHexKeyA), block_access_bits, sector_access_bits,sector_trailers_byte9, new Global().KEY(pnlKeyB, "txtLinearKeyB", chkHexKeyB), sector_formatted, auth_mode, key_index);

            if (iFResult == DL_OK) {
                txtSectorFormatted.setText(Byte.toString(sector_formatted.getValue()));
                Declarations.UFrDeclarations.UFRInstance.ReaderUISignal(FUNCT_LIGHT_OK, FUNCT_SOUND_OK);
                M.SetStatusBar(txtFErrorCode,txtFErrorExplain,iFResult);
            } else {
                txtSectorFormatted.setText(Byte.toString(sector_formatted.getValue()));
                Declarations.UFrDeclarations.UFRInstance.ReaderUISignal(FUNCT_LIGHT_ERROR,FUNCT_SOUND_ERROR);
                M.SetStatusBar(txtFErrorCode,txtFErrorExplain,iFResult);
            }
        } catch (NumberFormatException ex) {
            JOptionPane.showMessageDialog(rootPane, APPROPRIATE_FORMAT, "Error !", JOptionPane.ERROR_MESSAGE);
        } finally {
            M.SetFunct(false);
        }

    }//GEN-LAST:event_btnLinearFormatCardActionPerformed

    private void btnLinearFormatCardAKM1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLinearFormatCardAKM1ActionPerformed
       frmMain M = new frmMain();
        if (M.GetFunct() || M.GetLoop()) {
            return;
        }
        try
        {
          M.SetFunct(true);
          int iFResult               = 0;
          byte auth_mode             = (rbAUTH1A.isSelected() ? MIFARE_AUTHENT1A : MIFARE_AUTHENT1B);                                        
          byte block_access_bits     = 0;
          byte sector_access_bits    = 0;
          byte sector_trailers_byte9 = 0;
          ByteByReference sector_formatted = new ByteByReference();
        
            if (txtSectorTrailerByte9AKM1.getText().trim().isEmpty()) {
                JOptionPane.showMessageDialog(rootPane, "You must enter the  SECTOR TRAILER BYTE 9", "Warning", JOptionPane.WARNING_MESSAGE);
                txtSectorTrailerByte9AKM1.requestFocus();
                return;
            }
            txtSectorFormattedAKM1.setText("");
                       
            block_access_bits  = (byte) cboBlockAccessBitsAKM1.getSelectedIndex();
            sector_access_bits = (byte) cboSectorTrailerAccessBitsAKM1.getSelectedIndex();
            sector_trailers_byte9 = Byte.parseByte(txtSectorTrailerByte9AKM1.getText());

            iFResult = Declarations.UFrDeclarations.UFRInstance.LinearFormatCard_AKM1(new Global().KEY(pnlKeyA, "txtLinearKeyA", chkHexKeyA), block_access_bits, sector_access_bits,sector_trailers_byte9, new Global().KEY(pnlKeyB, "txtLinearKeyB", chkHexKeyB), sector_formatted, auth_mode);

            if (iFResult == DL_OK) {
                txtSectorFormattedAKM1.setText(Byte.toString(sector_formatted.getValue()));
                Declarations.UFrDeclarations.UFRInstance.ReaderUISignal(FUNCT_LIGHT_OK, FUNCT_SOUND_OK);
                M.SetStatusBar(txtFErrorCode,txtFErrorExplain,iFResult);
            } else {
                txtSectorFormattedAKM1.setText(Byte.toString(sector_formatted.getValue()));
                Declarations.UFrDeclarations.UFRInstance.ReaderUISignal(FUNCT_LIGHT_ERROR,FUNCT_SOUND_ERROR);
                M.SetStatusBar(txtFErrorCode,txtFErrorExplain,iFResult);
            }
        } catch (NumberFormatException ex) {
            JOptionPane.showMessageDialog(rootPane, APPROPRIATE_FORMAT, "Error !", JOptionPane.ERROR_MESSAGE);
        } finally {
            M.SetFunct(false);
        }

    }//GEN-LAST:event_btnLinearFormatCardAKM1ActionPerformed

    private void btnLinearFormatCardAKM2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLinearFormatCardAKM2ActionPerformed
        frmMain M = new frmMain();
        if (M.GetFunct() || M.GetLoop()) {
            return;
        }
        try
        {
          M.SetFunct(true);
          int iFResult               = 0;
          byte auth_mode             = (rbAUTH1A.isSelected() ? MIFARE_AUTHENT1A : MIFARE_AUTHENT1B);                                        
          byte block_access_bits     = 0;
          byte sector_access_bits    = 0;
          byte sector_trailers_byte9 = 0;
          
          ByteByReference sector_formatted = new ByteByReference();
        
            if (txtSectorTrailerByte9AKM2.getText().trim().isEmpty()) {
                JOptionPane.showMessageDialog(rootPane, "You must enter the  SECTOR TRAILER BYTE 9", "Warning", JOptionPane.WARNING_MESSAGE);
                txtSectorTrailerByte9AKM2.requestFocus();
                return;
            }
            txtSectorFormattedAKM2.setText("");            
            block_access_bits = (byte) cboBlockAccessBitsAKM2.getSelectedIndex();
            sector_access_bits = (byte) cboSectorTrailerAccessBitsAKM2.getSelectedIndex();
            sector_trailers_byte9 = Byte.parseByte(txtSectorTrailerByte9AKM2.getText());

            iFResult = Declarations.UFrDeclarations.UFRInstance.LinearFormatCard_AKM2(new Global().KEY(pnlKeyA, "txtLinearKeyA", chkHexKeyA), block_access_bits, sector_access_bits,sector_trailers_byte9, new Global().KEY(pnlKeyB, "txtLinearKeyB", chkHexKeyB), sector_formatted, auth_mode);

            if (iFResult == DL_OK) {
                txtSectorFormattedAKM2.setText(Byte.toString(sector_formatted.getValue()));
                Declarations.UFrDeclarations.UFRInstance.ReaderUISignal(FUNCT_LIGHT_OK, FUNCT_SOUND_OK);
                M.SetStatusBar(txtFErrorCode,txtFErrorExplain,iFResult);
            } else {
                txtSectorFormattedAKM2.setText(Byte.toString(sector_formatted.getValue()));
                Declarations.UFrDeclarations.UFRInstance.ReaderUISignal(FUNCT_LIGHT_ERROR,FUNCT_SOUND_ERROR);
                M.SetStatusBar(txtFErrorCode,txtFErrorExplain,iFResult);
            }
        } catch (NumberFormatException ex) {
            JOptionPane.showMessageDialog(rootPane, APPROPRIATE_FORMAT, "Error !", JOptionPane.ERROR_MESSAGE);
        } finally {
            M.SetFunct(false);
        }

    }//GEN-LAST:event_btnLinearFormatCardAKM2ActionPerformed

    private void btnLinearFormatCardPKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLinearFormatCardPKActionPerformed
        frmMain M = new frmMain();
        if (M.GetFunct() || M.GetLoop()) {
            return;
        }
        try
        {
          M.SetFunct(true);
          int iFResult               = 0;
          byte auth_mode             = (rbAUTH1A.isSelected() ? MIFARE_AUTHENT1A : MIFARE_AUTHENT1B);                                        
          byte block_access_bits     = 0;
          byte sector_access_bits    = 0;
          byte sector_trailers_byte9 = 0;
          ByteByReference sector_formatted = new ByteByReference();
        
            if (txtSectorTrailerByte9PK.getText().trim().isEmpty()) {
                JOptionPane.showMessageDialog(rootPane, "You must enter the  SECTOR TRAILER BYTE 9", "Warning", JOptionPane.WARNING_MESSAGE);
                txtSectorTrailerByte9PK.requestFocus();
                return;
            }
            txtSectorFormattedPK.setText("");            
            block_access_bits     = (byte) cboBlockAccessBitsPK.getSelectedIndex();
            sector_access_bits    = (byte) cboSectorTrailerAccessBitsPK.getSelectedIndex();
            sector_trailers_byte9 = Byte.parseByte(txtSectorTrailerByte9PK.getText());

            iFResult = Declarations.UFrDeclarations.UFRInstance.LinearFormatCard_PK(new Global().KEY(pnlKeyA, "txtLinearKeyA", chkHexKeyA), block_access_bits, sector_access_bits,sector_trailers_byte9, new Global().KEY(pnlKeyB, "txtLinearKeyB", chkHexKeyB), sector_formatted, auth_mode, new Global().PK_KEY(pnlHeader));

            if (iFResult == DL_OK) {
                txtSectorFormattedPK.setText(Byte.toString(sector_formatted.getValue()));
                Declarations.UFrDeclarations.UFRInstance.ReaderUISignal(FUNCT_LIGHT_OK, FUNCT_SOUND_OK);
                M.SetStatusBar(txtFErrorCode,txtFErrorExplain,iFResult);
            } else {
                txtSectorFormattedPK.setText(Byte.toString(sector_formatted.getValue()));
                Declarations.UFrDeclarations.UFRInstance.ReaderUISignal(FUNCT_LIGHT_ERROR,FUNCT_SOUND_ERROR);
                M.SetStatusBar(txtFErrorCode,txtFErrorExplain,iFResult);
            }
        } catch (NumberFormatException ex) {
            JOptionPane.showMessageDialog(rootPane, APPROPRIATE_FORMAT, "Error !", JOptionPane.ERROR_MESSAGE);
        } finally {
            M.SetFunct(false);
        }

    }//GEN-LAST:event_btnLinearFormatCardPKActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnLinearFormatCard;
    private javax.swing.JButton btnLinearFormatCardAKM1;
    private javax.swing.JButton btnLinearFormatCardAKM2;
    private javax.swing.JButton btnLinearFormatCardPK;
    private javax.swing.ButtonGroup btngAUTH1AB;
    private javax.swing.JComboBox cboBlockAccessBits;
    private javax.swing.JComboBox cboBlockAccessBitsAKM1;
    private javax.swing.JComboBox cboBlockAccessBitsAKM2;
    private javax.swing.JComboBox cboBlockAccessBitsPK;
    private javax.swing.JComboBox cboKeyIndex;
    private javax.swing.JComboBox cboSectorTrailerAccessBits;
    private javax.swing.JComboBox cboSectorTrailerAccessBitsAKM1;
    private javax.swing.JComboBox cboSectorTrailerAccessBitsAKM2;
    private javax.swing.JComboBox cboSectorTrailerAccessBitsPK;
    private javax.swing.JCheckBox chkHexKeyA;
    private javax.swing.JCheckBox chkHexKeyB;
    private javax.swing.JLabel lblBlockAccessBits;
    private javax.swing.JLabel lblBlockAccessBitsAKM1;
    private javax.swing.JLabel lblBlockAccessBitsAKM2;
    private javax.swing.JLabel lblBlockAccessBitsPK;
    private javax.swing.JTextField lblFunction;
    private javax.swing.JLabel lblKeyA;
    private javax.swing.JLabel lblKeyB;
    private javax.swing.JLabel lblKeyIndex;
    private javax.swing.JLabel lblPK;
    private javax.swing.JLabel lblSectorFormatted;
    private javax.swing.JLabel lblSectorFormattedAKM1;
    private javax.swing.JLabel lblSectorFormattedAKM2;
    private javax.swing.JLabel lblSectorFormattedPK;
    private javax.swing.JLabel lblSectorTrailerAccessBits;
    private javax.swing.JLabel lblSectorTrailerAccessBitsAKM1;
    private javax.swing.JLabel lblSectorTrailerAccessBitsAKM2;
    private javax.swing.JLabel lblSectorTrailerAccessBitsPK;
    private javax.swing.JLabel lblSectorTrailerByte9;
    private javax.swing.JLabel lblSectorTrailerByte9AKM1;
    private javax.swing.JLabel lblSectorTrailerByte9AKM2;
    private javax.swing.JLabel lblSectorTrailerByte9PK;
    private javax.swing.JTabbedPane pgLinearFormatCard;
    private javax.swing.JPanel pnlHeader;
    private javax.swing.JPanel pnlKeyA;
    private javax.swing.JPanel pnlKeyAB;
    private javax.swing.JPanel pnlKeyB;
    private javax.swing.JRadioButton rbAUTH1A;
    private javax.swing.JRadioButton rbAUTH1B;
    private javax.swing.JPanel tabLinearFormatCard;
    private javax.swing.JPanel tabLinearFormatCardAKM1;
    private javax.swing.JPanel tabLinearFormatCardAKM2;
    private javax.swing.JPanel tabLinearFormatCardPK;
    private javax.swing.JTextField txtFErrorCode;
    private javax.swing.JTextField txtFErrorExplain;
    private javax.swing.JTextField txtSectorFormatted;
    private javax.swing.JTextField txtSectorFormattedAKM1;
    private javax.swing.JTextField txtSectorFormattedAKM2;
    private javax.swing.JTextField txtSectorFormattedPK;
    private javax.swing.JTextField txtSectorTrailerByte9;
    private javax.swing.JTextField txtSectorTrailerByte9AKM1;
    private javax.swing.JTextField txtSectorTrailerByte9AKM2;
    private javax.swing.JTextField txtSectorTrailerByte9PK;
    // End of variables declaration//GEN-END:variables
}
