@Override
    public void actionPerformed(ActionEvent ae)
    {
        if(ae.getActionCommand().equals("Encode"))
        {
        StringBuilder str = new StringBuilder(jtfPlaintext.getText());
        
        //add 1 to each charecter
        for (int i=0; i<str.length(); i++)
            str.setCharAt(i, (char)(str.charAt(i)+1));
        
        jtfCiphertext.setText(str.toString());
        }
        
        else if(ae.getActionCommand().equals("Decode"))
        {
        StringBuilder str = new StringBuilder(jtfCiphertext.getText());
        
        for (int i=0; i<str.length(); i++)
            str.setCharAt(i, (char)(str.charAt(i) - 1));
        
        jtfPlaintext.setText(str.toString());
        }
        
        else
        {
        jtfPlaintext.setText("");
        jtfCiphertext.setText("");
        }
    }