private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        try {
            if (invoice.equals("-") && jTextField1.getText().contains("-")) {
                JOptionPane.showMessageDialog(this, "Please enter positive amount for invoice", "Error", JOptionPane.ERROR_MESSAGE);
                return;
            }

            OpenTransactionAccount openTransactionAccount = new OpenTransactionAccount();
            String validFrom = String.valueOf(System.currentTimeMillis() / 1000);
            String validTo = String.valueOf(dateField);
            /*if(dateField.getDate().getTime()<=System.currentTimeMillis()){
            JOptionPane.showMessageDialog(null , "Expiration date should be greater than today","Date error",JOptionPane.ERROR_MESSAGE);
            return;
            }*/
            this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            String chequeString = openTransactionAccount.writeCheque(serverID, nymID, accountID, validFrom, validTo, jTextArea1.getText(), jTextField3.getText(), invoice + jTextField1.getText());
            System.out.println("chequeString:" + chequeString);
            new OTWriteChequeOutput(null, true, chequeString).setVisible(true);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            this.setCursor(Cursor.getDefaultCursor());
        }

        this.dispose();
    }//GEN-LAST:event_jButton2ActionPerformed