private void jSaveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jSaveButtonActionPerformed
        try {
            
            if (this.jTextUsername.getText().trim().length() == 0) {
                //JOptionPane.showMessageDialog(null, "Please Provide a User Name", "OOPS!", JOptionPane.ERROR_MESSAGE);
                GeneralUtils.displayMessage("Please Provide a User Name", GeneralUtils.FAILURE_MESSAGE, this.jLabelNotification, jPanelNotificationPanel);
                this.jTextUsername.requestFocus();
                return;
            }
            if (this.jPassword1.getPassword().length == 0) {
                //JOptionPane.showMessageDialog(null, "Cannot leave Password field Empty!", "OOPS!", JOptionPane.ERROR_MESSAGE);
                GeneralUtils.displayMessage("Cannot leave Password field Empty!", GeneralUtils.FAILURE_MESSAGE, this.jLabelNotification, jPanelNotificationPanel);
                this.jPassword1.requestFocus();
                return;
            }

            if (!Arrays.equals(this.jPassword1.getPassword(), this.jPassword2.getPassword())) {
                //JOptionPane.showMessageDialog(null, "Both Passwords Do Not Match!", "OOPS!", JOptionPane.ERROR_MESSAGE);
                GeneralUtils.displayMessage("Both Passwords Do Not Match!", GeneralUtils.FAILURE_MESSAGE, this.jLabelNotification, jPanelNotificationPanel);
                this.jPassword2.requestFocus();
                return;
            }

            if (this.jTextInboxName.getText().trim().length() == 0) {
                //JOptionPane.showMessageDialog(null, "Please Provide a Folder to Monitor", "OOPS!", JOptionPane.ERROR_MESSAGE);
                GeneralUtils.displayMessage("Please Provide a Folder to Monitor!", GeneralUtils.FAILURE_MESSAGE, this.jLabelNotification, jPanelNotificationPanel);
                this.jTextInboxName.requestFocus();
                return;
            }
            
            if(this.jTextSubject.getText().trim().length()==0 && this.jTextSender.getText().trim().length()==0) {
                //JOptionPane.showMessageDialog(null, "You MUST provide either a Sender or a Subject !", "OOPS!", JOptionPane.ERROR_MESSAGE);
                GeneralUtils.displayMessage("You MUST provide either a Sender or a Subject !", GeneralUtils.FAILURE_MESSAGE, this.jLabelNotification, jPanelNotificationPanel);
                this.jTextSubject.requestFocus();
                return;
            }


            //Now persist the things in properties file.
            Map <String,String> propValues = new HashMap<String,String>();
            propValues.put("host", this.jHostCombo.getSelectedItem().toString().equals("gMail") ? "imap.gmail.com" : "imap.yahoo.com");
            propValues.put("username",this.jTextUsername.getText());
            propValues.put("password",new String(this.jPassword1.getPassword()));
            propValues.put("folder",this.jTextInboxName.getText());
            propValues.put("sender",this.jTextSender.getText());
            propValues.put("subject",this.jTextSubject.getText());
            PropertyFileWriter.writeToPropertyFile(propValues);
            
//            PropertyFileWriter.writeToPropertyFile("host", this.jHostCombo.getSelectedItem().toString().equals("gMail") ? "imap.gmail.com" : "imap.yahoo.com");
//            PropertyFileWriter.writeToPropertyFile("username", this.jTextUsername.getText());
//            PropertyFileWriter.writeToPropertyFile("password", new String(this.jPassword1.getPassword()));
//            PropertyFileWriter.writeToPropertyFile("folder", this.jTextInboxName.getText());
//            PropertyFileWriter.writeToPropertyFile("sender", this.jTextSender.getText());
//            PropertyFileWriter.writeToPropertyFile("subject", this.jTextSubject.getText());

            this.initSystemTray();
            
            //Stop previously running monitor
            this.stopGmailMonitor();
            
            //Now Initialize the Gmail Monitor.
            this.initGmailMonitor();
            
        } catch (AWTException ex) {
            System.out.println("OOPS! There was a problem in initializing the Tray!");
            GUI.getLoggerFrame().log("ERROR! There was a problem in initializing the Tray!");
            //ex.printStackTrace();
        }
    }//GEN-LAST:event_jSaveButtonActionPerformed