PLEASE some one help me to explain the code. This code is for a ScientificCalculator

package calculator;
import java.math.*;
//@author Hadisur Rahman

public class ScientificCalculator extends javax.swing.JFrame {
    private boolean zerodisp;
    private boolean decdisp;
    private boolean dgrrad;
    private boolean sh; //sh means =shift 
    private byte op;

    private double ina;
    private double inb;
    private double out;


    public ScientificCalculator() {
        initComponents();
    }
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jScrollBar1 = new javax.swing.JScrollBar();
        display2 = new javax.swing.JTextField();
        display1 = new javax.swing.JTextField();
        memorydisplay = new javax.swing.JTextField();
        memoryclear = new javax.swing.JButton();
        memorysave = new javax.swing.JButton();
        onedividedbyx = new javax.swing.JButton();
        cos = new javax.swing.JButton();
        sin = new javax.swing.JButton();
        memoryread = new javax.swing.JButton();
        tan = new javax.swing.JButton();
        pi = new javax.swing.JButton();
        add = new javax.swing.JButton();
        multply = new javax.swing.JButton();
        seven = new javax.swing.JButton();
        eight = new javax.swing.JButton();
        subtract = new javax.swing.JButton();
        nine = new javax.swing.JButton();
        percent = new javax.swing.JButton();
        five = new javax.swing.JButton();
        four = new javax.swing.JButton();
        one = new javax.swing.JButton();
        six = new javax.swing.JButton();
        three = new javax.swing.JButton();
        zero = new javax.swing.JButton();
        two = new javax.swing.JButton();
        negate = new javax.swing.JButton();
        decpoint = new javax.swing.JButton();
        cuberoot = new javax.swing.JButton();
        squared = new javax.swing.JButton();
        squareroot = new javax.swing.JButton();
        divide = new javax.swing.JButton();
        clear = new javax.swing.JButton();
        reset = new javax.swing.JButton();
        equals = new javax.swing.JButton();
        cubed = new javax.swing.JButton();
        degrees = new javax.swing.JRadioButton();
        radians = new javax.swing.JRadioButton();
        shift = new javax.swing.JToggleButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Scientific Calculator Made By Hadisur Rahman");
        setAlwaysOnTop(true);
        setIconImage(getIconImage());
        setResizable(false);

        display2.setBackground(new java.awt.Color(204, 255, 255));
        display2.setFont(new java.awt.Font("Tahoma", 3, 24)); // NOI18N
        display2.setForeground(new java.awt.Color(153, 102, 255));
        display2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        display2.setFocusable(false);
        display2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                display2ActionPerformed(evt);
            }
        });

        display1.setEditable(false);
        display1.setBackground(new java.awt.Color(222, 222, 190));
        display1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        display1.setForeground(new java.awt.Color(255, 102, 102));
        display1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        display1.setFocusable(false);
        display1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                display1ActionPerformed(evt);
            }
        });

        memorydisplay.setBackground(new java.awt.Color(255, 204, 204));
        memorydisplay.setFont(new java.awt.Font("Traditional Arabic", 1, 12)); // NOI18N
        memorydisplay.setText("0");
        memorydisplay.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        memorydisplay.setFocusable(false);

        memoryclear.setBackground(new java.awt.Color(204, 255, 102));
        memoryclear.setFont(new java.awt.Font("Yu Mincho", 1, 14)); // NOI18N
        memoryclear.setText("MC");
        memoryclear.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        memoryclear.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        memoryclear.setFocusable(false);
        memoryclear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                memoryclearActionPerformed(evt);
            }
        });

        memorysave.setBackground(new java.awt.Color(204, 255, 102));
        memorysave.setFont(new java.awt.Font("Yu Mincho", 1, 14)); // NOI18N
        memorysave.setText("MS");
        memorysave.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        memorysave.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        memorysave.setFocusable(false);
        memorysave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                memorysaveActionPerformed(evt);
            }
        });

        onedividedbyx.setBackground(new java.awt.Color(204, 255, 255));
        onedividedbyx.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        onedividedbyx.setText("1/x");
        onedividedbyx.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        onedividedbyx.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        onedividedbyx.setFocusable(false);
        onedividedbyx.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                onedividedbyxActionPerformed(evt);
            }
        });

        cos.setBackground(new java.awt.Color(217, 179, 255));
        cos.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        cos.setText("Cos");
        cos.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        cos.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        cos.setFocusable(false);
        cos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cosActionPerformed(evt);
            }
        });

        sin.setBackground(new java.awt.Color(217, 179, 255));
        sin.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        sin.setText("Sin");
        sin.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        sin.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        sin.setFocusable(false);
        sin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sinActionPerformed(evt);
            }
        });

        memoryread.setBackground(new java.awt.Color(204, 255, 102));
        memoryread.setFont(new java.awt.Font("Yu Mincho", 1, 14)); // NOI18N
        memoryread.setText("MR");
        memoryread.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        memoryread.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        memoryread.setFocusable(false);
        memoryread.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                memoryreadActionPerformed(evt);
            }
        });

        tan.setBackground(new java.awt.Color(217, 179, 255));
        tan.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        tan.setText("Tan");
        tan.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        tan.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        tan.setFocusable(false);
        tan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tanActionPerformed(evt);
            }
        });

        pi.setBackground(new java.awt.Color(204, 255, 255));
        pi.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        pi.setText("π");
        pi.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        pi.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        pi.setFocusable(false);
        pi.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                piActionPerformed(evt);
            }
        });

        add.setBackground(new java.awt.Color(204, 255, 255));
        add.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        add.setText("+");
        add.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        add.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        add.setFocusable(false);
        add.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addActionPerformed(evt);
            }
        });

        multply.setBackground(new java.awt.Color(204, 255, 255));
        multply.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        multply.setText("*");
        multply.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        multply.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        multply.setFocusable(false);
        multply.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                multplyActionPerformed(evt);
            }
        });

        seven.setBackground(new java.awt.Color(204, 255, 255));
        seven.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        seven.setText("7");
        seven.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        seven.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        seven.setFocusable(false);
        seven.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sevenActionPerformed(evt);
            }
        });

        eight.setBackground(new java.awt.Color(204, 255, 255));
        eight.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        eight.setText("8");
        eight.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        eight.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        eight.setFocusable(false);
        eight.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eightActionPerformed(evt);
            }
        });

        subtract.setBackground(new java.awt.Color(204, 255, 255));
        subtract.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        subtract.setText("-");
        subtract.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        subtract.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        subtract.setFocusable(false);
        subtract.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subtractActionPerformed(evt);
            }
        });

        nine.setBackground(new java.awt.Color(204, 255, 255));
        nine.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        nine.setText("9");
        nine.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        nine.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        nine.setFocusable(false);
        nine.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nineActionPerformed(evt);
            }
        });

        percent.setBackground(new java.awt.Color(204, 255, 255));
        percent.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        percent.setText("%");
        percent.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        percent.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        percent.setFocusable(false);
        percent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                percentActionPerformed(evt);
            }
        });

        five.setBackground(new java.awt.Color(204, 255, 255));
        five.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        five.setText("5");
        five.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        five.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        five.setFocusable(false);
        five.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fiveActionPerformed(evt);
            }
        });

        four.setBackground(new java.awt.Color(204, 255, 255));
        four.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        four.setText("4");
        four.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        four.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        four.setFocusable(false);
        four.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fourActionPerformed(evt);
            }
        });

        one.setBackground(new java.awt.Color(204, 255, 255));
        one.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        one.setText("1");
        one.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        one.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        one.setFocusable(false);
        one.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                oneActionPerformed(evt);
            }
        });

        six.setBackground(new java.awt.Color(204, 255, 255));
        six.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        six.setText("6");
        six.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        six.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        six.setFocusable(false);
        six.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sixActionPerformed(evt);
            }
        });

        three.setBackground(new java.awt.Color(204, 255, 255));
        three.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        three.setText("3");
        three.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        three.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        three.setFocusable(false);
        three.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                threeActionPerformed(evt);
            }
        });

        zero.setBackground(new java.awt.Color(204, 255, 255));
        zero.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        zero.setText("0");
        zero.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        zero.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        zero.setFocusable(false);
        zero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                zeroActionPerformed(evt);
            }
        });

        two.setBackground(new java.awt.Color(204, 255, 255));
        two.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        two.setText("2");
        two.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        two.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        two.setFocusable(false);
        two.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                twoActionPerformed(evt);
            }
        });

        negate.setBackground(new java.awt.Color(204, 255, 255));
        negate.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        negate.setText("±");
        negate.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        negate.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        negate.setFocusable(false);
        negate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                negateActionPerformed(evt);
            }
        });

        decpoint.setBackground(new java.awt.Color(204, 255, 255));
        decpoint.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        decpoint.setText(".");
        decpoint.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        decpoint.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        decpoint.setFocusable(false);
        decpoint.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                decpointActionPerformed(evt);
            }
        });

        cuberoot.setBackground(new java.awt.Color(204, 255, 255));
        cuberoot.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        cuberoot.setText("³√x");
        cuberoot.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        cuberoot.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        cuberoot.setFocusable(false);
        cuberoot.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cuberootActionPerformed(evt);
            }
        });

        squared.setBackground(new java.awt.Color(204, 255, 255));
        squared.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        squared.setText("x²");
        squared.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        squared.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        squared.setFocusable(false);
        squared.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                squaredActionPerformed(evt);
            }
        });

        squareroot.setBackground(new java.awt.Color(204, 255, 255));
        squareroot.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        squareroot.setText("√x");
        squareroot.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        squareroot.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        squareroot.setFocusable(false);
        squareroot.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                squarerootActionPerformed(evt);
            }
        });

        divide.setBackground(new java.awt.Color(204, 255, 255));
        divide.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        divide.setText("/");
        divide.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        divide.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        divide.setFocusable(false);
        divide.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                divideActionPerformed(evt);
            }
        });

        clear.setBackground(new java.awt.Color(218, 214, 137));
        clear.setFont(new java.awt.Font("Yu Gothic", 3, 18)); // NOI18N
        clear.setForeground(new java.awt.Color(255, 51, 51));
        clear.setText("CE");
        clear.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        clear.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        clear.setFocusable(false);
        clear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clearActionPerformed(evt);
            }
        });

        reset.setBackground(new java.awt.Color(218, 214, 137));
        reset.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
        reset.setForeground(new java.awt.Color(255, 51, 51));
        reset.setText("C");
        reset.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        reset.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        reset.setFocusable(false);
        reset.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                resetActionPerformed(evt);
            }
        });

        equals.setBackground(new java.awt.Color(218, 214, 137));
        equals.setFont(new java.awt.Font("Algerian", 1, 18)); // NOI18N
        equals.setText("=");
        equals.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        equals.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        equals.setFocusable(false);
        equals.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                equalsActionPerformed(evt);
            }
        });

        cubed.setBackground(new java.awt.Color(204, 255, 255));
        cubed.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        cubed.setText("x³");
        cubed.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        cubed.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        cubed.setFocusable(false);
        cubed.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cubedActionPerformed(evt);
            }
        });

        degrees.setBackground(new java.awt.Color(204, 204, 0));
        buttonGroup1.add(degrees);
        degrees.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
        degrees.setSelected(true);
        degrees.setText("Degrees");
        degrees.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        degrees.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        degrees.setFocusable(false);
        degrees.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                degreesActionPerformed(evt);
            }
        });

        radians.setBackground(new java.awt.Color(204, 204, 0));
        buttonGroup1.add(radians);
        radians.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
        radians.setText("Radians");
        radians.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        radians.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        radians.setFocusable(false);
        radians.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radiansActionPerformed(evt);
            }
        });

        shift.setBackground(new java.awt.Color(255, 204, 153));
        shift.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N
        shift.setText("Sh");
        shift.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        shift.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        shift.setFocusable(false);
        shift.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                shiftMouseClicked(evt);
            }
        });
        shift.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                shiftActionPerformed(evt);
            }
        });

        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(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(one, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(zero, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(seven, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(four, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(sin, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(memoryread, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(decpoint, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(two, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(five, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(memoryclear, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(cos, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(eight, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE))
                                .addGap(25, 25, 25)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(nine, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(tan, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                        .addComponent(memorysave, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                    .addComponent(six, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(three, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(negate, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)))
                            .addComponent(equals, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(degrees, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(radians, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(percent, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(squared, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(cuberoot, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(clear, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(squareroot, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(cubed, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(shift, 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, false)
                                    .addComponent(pi, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(add, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(subtract, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(multply, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(divide, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(reset, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(onedividedbyx, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                            .addComponent(memorydisplay)))
                    .addComponent(display1, javax.swing.GroupLayout.DEFAULT_SIZE, 401, Short.MAX_VALUE)
                    .addComponent(display2, javax.swing.GroupLayout.DEFAULT_SIZE, 401, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(display2, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(display1, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(12, 12, 12)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(memoryclear, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(memorysave, javax.swing.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE)
                    .addComponent(memorydisplay)
                    .addComponent(memoryread, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(degrees)
                            .addComponent(radians))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(cos, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(sin, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tan, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(7, 7, 7)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(seven, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(nine, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(eight, 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()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(four, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                        .addComponent(five, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(7, 7, 7)))
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(two, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(one, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(three, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(six, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(onedividedbyx, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(percent, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(48, 48, 48))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(shift, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(pi, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(add, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(squared, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(subtract, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(squareroot, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(multply, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(cubed, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(zero, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(negate, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(decpoint, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cuberoot, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(divide, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(clear, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(reset, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(equals, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>                        

    private void memoryreadActionPerformed(java.awt.event.ActionEvent evt) {                                           
     display1.setText(String.valueOf(memorydisplay.getText()));   
    }                                          

    private void onedividedbyxActionPerformed(java.awt.event.ActionEvent evt) {                                              
      inb =Double.parseDouble(String.valueOf(display1.getText()));
      out = 1 / inb;
       if( out > -100000000 && out < 100000000 ){
           display1.setText(String.valueOf(out));
       }
       else{
              display1.setText("Error");
       }
       display2.setText( "1/" +  String.valueOf(inb));
       out = 0;
       op = 0;

    }                                             

    private void cosActionPerformed(java.awt.event.ActionEvent evt) {                                    
        inb = Double.parseDouble(String.valueOf(display1.getText()));
     if(!sh){
         if(!dgrrad){
              display2.setText("cos(" + String.valueOf(inb) + ")");
             inb = inb * 0.0174532925;
         }
         out = Math.cos(inb);
     }
     else{
         display2.setText("cosh(" + String.valueOf(inb) + ")");
           out = Math.cosh(inb);
     }

     display1.setText(String.valueOf(out));
     out = 0;
     op = 0;
    }                                   

    private void sinActionPerformed(java.awt.event.ActionEvent evt) {                                    
     inb = Double.parseDouble(String.valueOf(display1.getText()));
     if(!sh){
         if(!dgrrad){
              display2.setText("sin(" + String.valueOf(inb) + ")");
             inb = inb * 0.0174532925;
         }
         out = Math.sin(inb);
     }
     else{
         display2.setText("sinh(" + String.valueOf(inb) + ")");
           out = Math.sinh(inb);
     }

     display1.setText(String.valueOf(out));
     out = 0;
     op = 0;
    }                                   

    private void fourActionPerformed(java.awt.event.ActionEvent evt) {                                     
        if(!zerodisp && !decdisp){
           display1.setText(null);
       }
       display1.setText(display1.getText()+"4");
       zerodisp =true;
    }                                    

    private void fiveActionPerformed(java.awt.event.ActionEvent evt) {                                     
        if(!zerodisp && !decdisp){
           display1.setText(null);
       }
       display1.setText(display1.getText()+"5");
       zerodisp =true;
    }                                    

    private void zeroActionPerformed(java.awt.event.ActionEvent evt) {                                     
       if( ! zerodisp && ! decdisp){
           display1.setText(null);
       }
       display1.setText(display1.getText()+ "0");
    }                                    

    private void oneActionPerformed(java.awt.event.ActionEvent evt) {                                    
         if(!zerodisp && !decdisp){
           display1.setText(null);
       }
       display1.setText(display1.getText()+"1");
       zerodisp =true;
    }                                   

    private void twoActionPerformed(java.awt.event.ActionEvent evt) {                                    
        if(!zerodisp && !decdisp){
           display1.setText(null);
       }
       display1.setText(display1.getText()+"2");
       zerodisp =true;
    }                                   

    private void threeActionPerformed(java.awt.event.ActionEvent evt) {                                      
         if(!zerodisp && !decdisp){
           display1.setText(null);
       }
       display1.setText(display1.getText()+"3");
       zerodisp =true;
    }                                     

    private void sixActionPerformed(java.awt.event.ActionEvent evt) {                                    
         if(!zerodisp && !decdisp){
           display1.setText(null);
       }
       display1.setText(display1.getText()+"6");
       zerodisp =true;
    }                                   

    private void sevenActionPerformed(java.awt.event.ActionEvent evt) {                                      
        if(!zerodisp && !decdisp){
           display1.setText(null);
       }
       display1.setText(display1.getText()+"7");
       zerodisp =true;
    }                                     

    private void eightActionPerformed(java.awt.event.ActionEvent evt) {                                      
        if(!zerodisp && !decdisp){
           display1.setText(null);
       }
       display1.setText(display1.getText()+"8");
       zerodisp =true;
    }                                     

    private void nineActionPerformed(java.awt.event.ActionEvent evt) {                                     
        if(!zerodisp && !decdisp){
           display1.setText(null);
       }
       display1.setText(display1.getText()+"9");
       zerodisp =true;
    }                                    

    private void decpointActionPerformed(java.awt.event.ActionEvent evt) {                                         
     if(! decdisp){
        display1.setText(display1.getText()+".");  
        decdisp = true;
     }
    }                                        

    private void negateActionPerformed(java.awt.event.ActionEvent evt) {                                       
       inb = Double.parseDouble(String.valueOf(display1.getText()));
       out=inb * -1 ;

       if( out > -100000000 && out < 100000000 ){
           display1.setText(String.valueOf(out));
       }
       else{
              display1.setText("Error");
       }
       decdisp = true;
       out = 0;
    }                                      


    private void clearActionPerformed(java.awt.event.ActionEvent evt) {                                      
       display1.setText("0");
      zerodisp = false;  
      decdisp = false;  
    }                                     

    private void resetActionPerformed(java.awt.event.ActionEvent evt) {                                      
       display1.setText("0");
       display2.setText(null);
       zerodisp = false;  
       decdisp = false;  
       ina = 0;
       inb = 0; 
       out = 0;

    }                                     

    private void display1ActionPerformed(java.awt.event.ActionEvent evt) {                                         

    }                                        

    private void memoryclearActionPerformed(java.awt.event.ActionEvent evt) {                                            
      memorydisplay.setText("0");
    }                                           

    private void memorysaveActionPerformed(java.awt.event.ActionEvent evt) {                                           
       memorydisplay.setText(String.valueOf(display1.getText())); 
    }                                          

    private void percentActionPerformed(java.awt.event.ActionEvent evt) {                                        
         ina =Double.parseDouble(String.valueOf(display1.getText()));
         display1.setText("0");
         display2.setText(String.valueOf(ina)+ "%(");
         decdisp = false;
         zerodisp = false;
         op = 5;

    }                                       

    private void piActionPerformed(java.awt.event.ActionEvent evt) {                                   
      display1.setText(String.valueOf(Math.PI));
    }                                  

    private void squaredActionPerformed(java.awt.event.ActionEvent evt) {                                        
        inb = Double.parseDouble(String.valueOf(display1.getText()));
        out = inb * inb;

         if( out > -100000000 && out < 100000000 ){
           display1.setText(String.valueOf(out));
       }
       else{
              display1.setText("Error");
       }
         display2.setText(String.valueOf(inb) + "²");
         out = 0;
         op = 0;

    }                                       

    private void squarerootActionPerformed(java.awt.event.ActionEvent evt) {                                           
        inb = Double.parseDouble(String.valueOf(display1.getText()));
        out = Math.sqrt(inb);

        display1.setText(String.valueOf(out));
        display2.setText( "√" + String.valueOf(inb));
         out = 0;
         op = 0;

    }                                          

    private void cubedActionPerformed(java.awt.event.ActionEvent evt) {                                      
       inb = Double.parseDouble(String.valueOf(display1.getText()));
        out = inb * inb * inb;

         if( out > -100000000 && out < 100000000 ){
           display1.setText(String.valueOf(out));
       }
       else{
              display1.setText("Error");
       }
         display2.setText(String.valueOf(inb) + "³");
         out = 0;
         op = 0;

    }                                     

    private void cuberootActionPerformed(java.awt.event.ActionEvent evt) {                                         
        inb = Double.parseDouble(String.valueOf(display1.getText()));
        out = Math.cbrt(inb);

        display1.setText(String.valueOf(out));
        display2.setText( "³√" + String.valueOf(inb));
         out = 0;
        op = 0;
    }                                        

    private void shiftMouseClicked(java.awt.event.MouseEvent evt) {                                   
        // TODO add your handling code here:
    }                                  

    private void tanActionPerformed(java.awt.event.ActionEvent evt) {                                    
         inb = Double.parseDouble(String.valueOf(display1.getText()));
     if(!sh){
         if(!dgrrad){
              display2.setText("tan(" + String.valueOf(inb) + ")");
             inb = inb * 0.0174532925;
         }
         out = Math.tan(inb);
     }
     else{
         display2.setText("tanh(" + String.valueOf(inb) + ")");
           out = Math.tanh(inb);
     }

     display1.setText(String.valueOf(out));
     out = 0;
     op = 0;
    }                                   

    private void shiftActionPerformed(java.awt.event.ActionEvent evt) {                                      
       if(sh){
           sh = true ;
       }
       else{
           sh = false;
       }
    }                                     

    private void addActionPerformed(java.awt.event.ActionEvent evt) {                                    
        if(op ==0){
            ina =Double.parseDouble(String.valueOf(display1.getText()));
        }
        else{
              inb =Double.parseDouble(String.valueOf(display1.getText()));
        }
        if( op == 1 ){
            ina = ina + inb;
        }
         if( op == 2 ){
            ina = ina - inb;
        }
         if( op == 3 ){
            ina = ina * inb;
        }
         if( op == 4 ){
            ina = ina / inb;
        }
         if( op == 5 ){
            ina = ina * inb / 100;
        }
         display1.setText("0");
         display2.setText(String.valueOf(ina) + " + ");
         op = 1;
         decdisp = false;
         zerodisp = false;

    }                                   

    private void subtractActionPerformed(java.awt.event.ActionEvent evt) {                                         
         if(op ==0){
            ina =Double.parseDouble(String.valueOf(display1.getText()));
        }
        else{
              inb =Double.parseDouble(String.valueOf(display1.getText()));
        }
        if( op == 1 ){
            ina = ina + inb;
        }
         if( op == 2 ){
            ina = ina - inb;
        }
         if( op == 3 ){
            ina = ina * inb;
        }
         if( op == 4 ){
            ina = ina / inb;
        }
         if( op == 5 ){
            ina = ina * inb / 100;
        }
         display1.setText("0");;
         display2.setText(String.valueOf(ina) + " - ");
         op = 2;
         decdisp = false;
         zerodisp = false;
    }                                        

    private void multplyActionPerformed(java.awt.event.ActionEvent evt) {                                        
        if(op ==0){
            ina =Double.parseDouble(String.valueOf(display1.getText()));
        }
        else{
              inb =Double.parseDouble(String.valueOf(display1.getText()));
        }
        if( op == 1 ){
            ina = ina + inb;
        }
         if( op == 2 ){
            ina = ina - inb;
        }
         if( op == 3 ){
            ina = ina * inb;
        }
         if( op == 4 ){
            ina = ina / inb;
        }
         if( op == 5 ){
            ina = ina * inb / 100;
        }
         display1.setText("0");
         display2.setText(String.valueOf(ina) + " * ");
         op = 3;
         decdisp = false;
         zerodisp = false;
    }                                       

    private void divideActionPerformed(java.awt.event.ActionEvent evt) {                                       
      if(op ==0){
            ina =Double.parseDouble(String.valueOf(display1.getText()));
        }
        else{
              inb =Double.parseDouble(String.valueOf(display1.getText()));
        }
        if( op == 1 ){
            ina = ina + inb;
        }
         if( op == 2 ){
            ina = ina - inb;
        }
         if( op == 3 ){
            ina = ina * inb;
        }
         if( op == 4 ){
            ina = ina / inb;
        }
         if( op == 5 ){
            ina = ina * inb / 100;
        }
         display1.setText("0");;
         display2.setText(String.valueOf(ina) + " / ");
         op = 4;
         decdisp = false;
         zerodisp = false;
    }                                      

    private void equalsActionPerformed(java.awt.event.ActionEvent evt) {                                       
      inb =Double.parseDouble(String.valueOf(display1.getText()));
      if( op == 0){
          out = inb;
          display2.setText(String.valueOf(inb));
      }
      if( op == 1){
          out = ina + inb;
          display2.setText(display2.getText() + String.valueOf(inb));
      }
      if( op == 2){
          out = ina - inb;
          display2.setText(display2.getText() + String.valueOf(inb));
      }
      if( op == 3){
          out = ina * inb;
          display2.setText(display2.getText() + String.valueOf(inb));
      }
      if( op == 4){
          out = ina / inb;
          display2.setText(display2.getText() + String.valueOf(inb));
      }
      if( op == 5){
          out = ina + inb / 100;
          display2.setText(display2.getText() + String.valueOf(inb) + ")");
      }
        if( out > -100000000 && out < 100000000 ){
           display1.setText(String.valueOf(out));
       }
       else{
              display1.setText("Error");
       }
        ina = 0;
        inb = 0;
        out = 0;
        decdisp = false;
        zerodisp = false;
    }                                      

    private void radiansActionPerformed(java.awt.event.ActionEvent evt) {                                        
        dgrrad = true;
    }                                       

    private void degreesActionPerformed(java.awt.event.ActionEvent evt) {                                        
        dgrrad = false;
    }                                       

    private void display2ActionPerformed(java.awt.event.ActionEvent evt) {                                         

    }                                        

    public static void main(String args[]) {

        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ScientificCalculator().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JButton add;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton clear;
    private javax.swing.JButton cos;
    private javax.swing.JButton cubed;
    private javax.swing.JButton cuberoot;
    private javax.swing.JButton decpoint;
    private javax.swing.JRadioButton degrees;
    private javax.swing.JTextField display1;
    private javax.swing.JTextField display2;
    private javax.swing.JButton divide;
    private javax.swing.JButton eight;
    private javax.swing.JButton equals;
    private javax.swing.JButton five;
    private javax.swing.JButton four;
    private javax.swing.JScrollBar jScrollBar1;
    private javax.swing.JButton memoryclear;
    private javax.swing.JTextField memorydisplay;
    private javax.swing.JButton memoryread;
    private javax.swing.JButton memorysave;
    private javax.swing.JButton multply;
    private javax.swing.JButton negate;
    private javax.swing.JButton nine;
    private javax.swing.JButton one;
    private javax.swing.JButton onedividedbyx;
    private javax.swing.JButton percent;
    private javax.swing.JButton pi;
    private javax.swing.JRadioButton radians;
    private javax.swing.JButton reset;
    private javax.swing.JButton seven;
    private javax.swing.JToggleButton shift;
    private javax.swing.JButton sin;
    private javax.swing.JButton six;
    private javax.swing.JButton squared;
    private javax.swing.JButton squareroot;
    private javax.swing.JButton subtract;
    private javax.swing.JButton tan;
    private javax.swing.JButton three;
    private javax.swing.JButton two;
    private javax.swing.JButton zero;
    // End of variables declaration                   
}

Edited 1 Year Ago by JamesCherrill: Moved to Java forum

I want to understand your request here, you want someone to explain 1187 lines of code to you? If you wrote it, you should understand most of it!

What about it do you not understand?

ps: You claim to be the author of that code, so how did you write it if you don't understand it?

most of this code is NetBeans generated UI code. The rest of the code is mostly very simple, and unefficiently written conditional statements.

Maybe you should ask the person who wrote the code, or just read it. the stuff that isn't generated (that you should look at to understand it) is not that hard to get for someone who understands the business requirements.

This article has been dead for over six months. Start a new discussion instead.