Jump to content

Is this any good at all?

- - - - -

  • Please log in to reply
2 replies to this topic

#1
Chall

Chall

    Newbie

  • Members
  • PipPip
  • 15 posts
I know that is simple and what not, but is it any good at all? (I know it needs some revising)
/*

 * SuperCalc.java

 *

 * Created on Oct 11, 2011, 11:49 PM

 */


/**

 *

 * @author Calvin G. Hall

 */

import java.lang.Math;


public class SuperCalc extends javax.swing.JFrame {


    public SuperCalc() {

        initComponents();

    }

    public double Ns;

	public double N1;

	public double N1_1;

	public double N1_2;

	public double N1_3;

	public double N2;

	public double N2_1;

	public double N2_2;

	public double N2_3;

	public double N3;

	public double N3_1;

	public double N3_2;

	public double N3_3;

	public double N4;

	public double N4_1;

	public double N4_2;

	public double N4_3;

	public double N5;

	public double N5_1;

	public double N5_2;

	public double N5_3;

	public double N6;

    public double N6_1;

    public double N6_2;

    public double N6_3;

    public double a1;

	public double Var1;

	public double Var2;

	public double Var3;

	public double Gain1;

	public double Gain2;

	public double a5;

    public double MMem=0;

    public double M2Mem=0;

    public double M3Mem=0;

    public double M4Mem=0;

    public double MCur;

    public double MCmd;

    public double outcome;

    public double P1ar1;

    public double P1ar2;

    public double P1ar3;

    public double P1ar4;

    public double P2ar1;

    public double P2ar2;

    public double P2ar3;

    public double P2ar4;

    public double P3ar1;

    public double P3ar2;

    public double P3ar3;

    public double P3ar4;

    public double Ps=0;

    public double pe=0;

    public double ar1;

    public double ar2;

    public double ar3;

    public double ar4;

    public double jC;

    public double es=0;

    public double Secondary=0;

    public double JustEqualed=0;

	public double Decimalize=0;

	public double Percent=0;

	public double SqrRooted=0;

	public int Decim=0;

	public long c;

	public long d;

	public double Decimal1=0;

	public double Decimal2=0;

	public double Decimal3=0;


    @SuppressWarnings("unchecked")


    private void initComponents() {


        jTextField1 = new javax.swing.JTextField();

        jScrollPane1 = new javax.swing.JScrollPane();

        jTextPane1 = new javax.swing.JTextPane();

        Formula = new javax.swing.JComboBox();

        Solution2 = new javax.swing.JTextField();

        setMem = new javax.swing.JButton();

        addMem = new javax.swing.JButton();

        subtractMem = new javax.swing.JButton();

        clear = new javax.swing.JButton();

        clearMem = new javax.swing.JButton();

        Pluss = new javax.swing.JButton();

        Minus = new javax.swing.JButton();

        Multiply = new javax.swing.JButton();

        Devide = new javax.swing.JButton();

        CmdEquals = new javax.swing.JButton();

        MD = new javax.swing.JButton();

        Sqrd = new javax.swing.JButton();

        Cube = new javax.swing.JButton();

        pI = new javax.swing.JButton();

        setMem2 = new javax.swing.JButton();

        DisplayM2 = new javax.swing.JButton();

        setM3 = new javax.swing.JButton();

        useM3 = new javax.swing.JButton();

        jLabel1 = new javax.swing.JLabel();

        Num7 = new javax.swing.JButton();

        Num8 = new javax.swing.JButton();

        Num9 = new javax.swing.JButton();

        Num4 = new javax.swing.JButton();

        Num5 = new javax.swing.JButton();

        Num6 = new javax.swing.JButton();

        Num1 = new javax.swing.JButton();

        Num2 = new javax.swing.JButton();

        Num3 = new javax.swing.JButton();

        Num0 = new javax.swing.JButton();

		DecimalPlace = new javax.swing.JButton();

		Negative = new javax.swing.JButton();

		AreaCir = new javax.swing.JButton();

		PercentButton = new javax.swing.JButton();

		SquareRootDo = new javax.swing.JButton();


        jTextField1.setText("jTextField1");


        jScrollPane1.setViewportView(jTextPane1);


        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        setTitle("SuperMath v3.1_56    Calvin Hall");

        setAlwaysOnTop(true);

        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        setType(java.awt.Window.Type.UTILITY);


        Formula.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "No formula", "volume cube = Length*Length*Length", "volume rectangular prism = Length*Width*Height", "volume cylinder = b*h = (pi*r SQUARED)*h", "volume pyramid = (1/3)*b*h", "volume cone =(1/3)*b*h=((1/3pi)*rSQUARED)*h", "volume sphere = ((4/3)pi)*r CUBED", "Area regular polygon =((1/2)N)sin(360/N)S SQUARED" }));

        Formula.setToolTipText("Use to select formula");

        Formula.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                FormulaActionPerformed(evt);

            }

        });

        Formula.addPropertyChangeListener(new java.beans.PropertyChangeListener() {

            public void propertyChange(java.beans.PropertyChangeEvent evt) {

                FormulaPropertyChange(evt);

            }

        });


        Solution2.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        Solution2.setText("0");

        Solution2.addMouseListener(new java.awt.event.MouseAdapter() {

            public void mouseClicked(java.awt.event.MouseEvent evt) {

                Solution2MouseClicked(evt);

            }

        });

        Solution2.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                Solution2ActionPerformed(evt);

            }

        });


        setMem.setText("M=");

        setMem.setToolTipText("Set Memory");

        setMem.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                setMemActionPerformed(evt);

            }

        });


        addMem.setText("M+");

        addMem.setToolTipText("Set Memory pluss x");

        addMem.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                addMemActionPerformed(evt);

            }

        });


        subtractMem.setText("M-");

        subtractMem.setToolTipText("Set Memory Minus x");

        subtractMem.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                subtractMemActionPerformed(evt);

            }

        });


        clear.setText("Clear");

        clear.setToolTipText("Clear");

        clear.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                clearActionPerformed(evt);

            }

        });


        clearMem.setText("Clear M");

        clearMem.setToolTipText("Clear Memory");

        clearMem.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                clearMemActionPerformed(evt);

            }

        });


        Pluss.setText("+");

        Pluss.setToolTipText("Pluss");

        Pluss.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                PlussActionPerformed(evt);

            }

        });


        Minus.setText("-");

        Minus.setToolTipText("Minus");

        Minus.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                MinusActionPerformed(evt);

            }

        });


        Multiply.setText("*");

        Multiply.setToolTipText("Multiply");

        Multiply.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                MultiplyActionPerformed(evt);

            }

        });


        Devide.setText("/");

        Devide.setToolTipText("Devide");

        Devide.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                DevideActionPerformed(evt);

            }

        });


        CmdEquals.setText("=");

        CmdEquals.setToolTipText("Equals");

        CmdEquals.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                CmdEqualsActionPerformed(evt);

            }

        });


        MD.setText("M");

        MD.setToolTipText("Display Memory");

        MD.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                MDActionPerformed(evt);

            }

        });


        Sqrd.setText("x2");

        Sqrd.setToolTipText("Square");

        Sqrd.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                SqrdActionPerformed(evt);

            }

        });


        Cube.setText("x3");

        Cube.setToolTipText("Cube");

        Cube.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                CubeActionPerformed(evt);

            }

        });


        pI.setText("pI");

        pI.setToolTipText("pI");

        pI.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                pIActionPerformed(evt);

            }

        });


        setMem2.setText("M2=");

        setMem2.setToolTipText("Set Memory2");

        setMem2.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                setMem2ActionPerformed(evt);

            }

        });


        DisplayM2.setText("M2");

        DisplayM2.setToolTipText("Use M2");

        DisplayM2.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                DisplayM2ActionPerformed(evt);

            }

        });


        setM3.setText("M3=");

        setM3.setToolTipText("Set Memory 3");

        setM3.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                setM3ActionPerformed(evt);

            }

        });


        useM3.setText("M3");

        useM3.setToolTipText("Use Memory3");

        useM3.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                useM3ActionPerformed(evt);

            }

        });


        jLabel1.setText("Formulas");


        Num7.setText("7");

        Num7.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                Num7ActionPerformed(evt);

            }

        });


        Num8.setText("8");

        Num8.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                Num8ActionPerformed(evt);

            }

        });


        Num9.setText("9");

        Num9.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                Num9ActionPerformed(evt);

            }

        });


        Num4.setText("4");

        Num4.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                Num4ActionPerformed(evt);

            }

        });


        Num5.setText("5");

        Num5.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                Num5ActionPerformed(evt);

            }

        });


        Num6.setText("6");

        Num6.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                Num6ActionPerformed(evt);

            }

        });


        Num1.setText("1");

        Num1.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                Num1ActionPerformed(evt);

            }

        });


        Num2.setText("2");

        Num2.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                Num2ActionPerformed(evt);

            }

        });


        Num3.setText("3");

        Num3.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                Num3ActionPerformed(evt);

            }

        });


        Num0.setText("0");

        Num0.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                Num0ActionPerformed(evt);

            }

        });

        DecimalPlace.setText(".");

		DecimalPlace.setToolTipText("Decimal Point, Does not show zeros, but they are there.");

        DecimalPlace.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                DecimalPlaceActionPerformed(evt);

            }

        });

		Negative.setText("-");

		Negative.setToolTipText("Set numbers negative");

		Negative.addActionListener(new java.awt.event.ActionListener() {

			public void actionPerformed(java.awt.event.ActionEvent evt) {

				NegativeActionPreformed(evt);

			}

		});

		AreaCir.setText("arCr");

		AreaCir.setToolTipText("area of a circle, radius in number box, plox");

		AreaCir.addActionListener(new java.awt.event.ActionListener() {

			public void actionPerformed(java.awt.event.ActionEvent evt) {

				AreaCirActionPreformed(evt);

			}

		});

		PercentButton.setText("a%");

		PercentButton.setToolTipText("Turn Current number into a percent");

		PercentButton.addActionListener(new java.awt.event.ActionListener() {

			public void actionPerformed(java.awt.event.ActionEvent evt) {

				PercentButtonActionPreformed(evt);

			}

		});

		SquareRootDo.setText("Rt");

		SquareRootDo.setToolTipText("Square root function");

		SquareRootDo.addActionListener(new java.awt.event.ActionListener() {

			public void actionPerformed(java.awt.event.ActionEvent evt) {

				SquareRootDoActionPerformed(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(layout.createSequentialGroup()

                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                            .addComponent(Solution2, javax.swing.GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE)

                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()

                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

									.addComponent(SquareRootDo, 0, 0, Short.MAX_VALUE)

									.addComponent(PercentButton, 0, 0, Short.MAX_VALUE)

									.addComponent(AreaCir, 0, 0, Short.MAX_VALUE)

                                    .addComponent(setMem2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

                                    .addComponent(MD, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

                                    .addComponent(setMem, 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(DecimalPlace, 0, 0, Short.MAX_VALUE)

                                    .addComponent(Num1, 0, 0, Short.MAX_VALUE)

                                    .addComponent(Num4, 0, 0, Short.MAX_VALUE)

                                    .addComponent(Num7, 0, 0, Short.MAX_VALUE)

                                    .addComponent(setM3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

                                    .addComponent(Sqrd, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

                                    .addComponent(addMem, 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.TRAILING)

                                    .addComponent(Num0, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 51, Short.MAX_VALUE)

                                    .addComponent(Num2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 51, Short.MAX_VALUE)

                                    .addComponent(Num5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 51, Short.MAX_VALUE)

                                    .addComponent(useM3, javax.swing.GroupLayout.DEFAULT_SIZE, 51, Short.MAX_VALUE)

                                    .addComponent(Cube, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 51, Short.MAX_VALUE)

                                    .addComponent(subtractMem, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 51, Short.MAX_VALUE)

                                    .addComponent(Num8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 51, Short.MAX_VALUE))

                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                                    .addComponent(clearMem)

                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)

										.addComponent(Negative, 0, 0, Short.MAX_VALUE)

                                        .addComponent(Num3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

                                        .addComponent(Num6, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)

                                        .addComponent(Num9, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)

                                        .addComponent(DisplayM2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

                                        .addComponent(pI, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE)))

                                .addGap(63, 63, 63)

                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                                    .addComponent(clear, javax.swing.GroupLayout.Alignment.TRAILING)

                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)

                                        .addComponent(Pluss, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

                                        .addComponent(Minus, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

                                        .addComponent(Devide, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

                                        .addComponent(Multiply, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 56, Short.MAX_VALUE)

                                        .addComponent(CmdEquals, javax.swing.GroupLayout.Alignment.LEADING)))

                                .addGap(3, 3, 3)))

                        .addContainerGap())

                    .addGroup(layout.createSequentialGroup()

                        .addComponent(Formula, 0, 311, Short.MAX_VALUE)

                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

                        .addComponent(jLabel1)

                        .addGap(23, 23, 23))))

        );

        layout.setVerticalGroup(

            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

            .addGroup(layout.createSequentialGroup()

                .addGap(4, 4, 4)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(Formula, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

                    .addComponent(jLabel1))

                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

                .addComponent(Solution2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(setMem)

                    .addComponent(clear)

                    .addComponent(addMem)

                    .addComponent(clearMem)

                    .addComponent(subtractMem))

                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                    .addGroup(layout.createSequentialGroup()

                        .addComponent(Pluss)

                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

                        .addComponent(Minus)

                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

                        .addComponent(Multiply)

                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

                        .addComponent(Devide)

                        .addGap(3, 3, 3)

                        .addComponent(CmdEquals, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))

                    .addGroup(layout.createSequentialGroup()

                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                            .addComponent(MD)

                            .addComponent(Sqrd)

                            .addComponent(pI)

                            .addComponent(Cube))

                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                            .addComponent(setMem2)

                            .addComponent(useM3)

                            .addComponent(DisplayM2)

                            .addComponent(setM3))

                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

							.addComponent(AreaCir)

                            .addComponent(Num7)

                            .addComponent(Num8)

                            .addComponent(Num9))

                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

							.addComponent(PercentButton)

                            .addComponent(Num4)

                            .addComponent(Num5)

                            .addComponent(Num6))

                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

							.addComponent(SquareRootDo)

                            .addComponent(Num1)

                            .addComponent(Num2)

                            .addComponent(Num3))))

                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

				.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

				.addComponent(DecimalPlace)

                .addComponent(Num0)

				.addComponent(Negative))

                .addContainerGap(63, Short.MAX_VALUE))

        );


        pack();

    }


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


    }                                       


    private void FormulaPropertyChange(java.beans.PropertyChangeEvent evt) {                                       


    }

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

			try{

				ar3= (double) ((Double.parseDouble(Solution2.getText())));

				ar3=(ar3*3.1415);

				ar3=ar3*ar3;

				Solution2.setText("" + ar3);

				jC=1;

						Decim=0;

		Decimalize=0;

			} catch (NumberFormatException e){

				ar3= 0;

				ar3=(ar3*3.1415);

				ar3=ar3*ar3;

				Solution2.setText("" + ar3);

				jC=1;

						Decim=0;

		Decimalize=0;

			}

		}

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

    if(Ps==0){

		if(MCmd==0){

			try{

				ar1 = (double) ((Double.parseDouble(Solution2.getText())));

				Solution2.setText("0");

				MCmd=1;

				jC=1;

				Secondary=1;

						Decim=0;

		Decimalize=0;

			} catch (NumberFormatException e){

				ar1 = 0;

				Solution2.setText("0");

				MCmd=1;

				jC=1;

				Secondary=1;

						Decim=0;

		Decimalize=0;

			}

		}

		else{

			if(MCmd==1){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1+ar2;

					Solution2.setText("0");

					MCmd=1;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

					

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1+ar2;

					Solution2.setText("0");

					MCmd=1;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				}

			}

			if(MCmd==2){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1-ar2;

					Solution2.setText("0");

					MCmd=1;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1-ar2;

					Solution2.setText("0");

					MCmd=1;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				}

			}

			if(MCmd==3){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1*ar2;

					Solution2.setText("0");

					MCmd=1;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1*ar2;

					Solution2.setText("0");

					MCmd=1;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				}

			}

			if(MCmd==4){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1/ar2;

					Solution2.setText("0");

					MCmd=1;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1/ar2;

					Solution2.setText("0");

					MCmd=1;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				}

			}

		}

    }

}                                     


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

    if(Ps==0){

		if(MCmd==0){

			try{

				ar1 = (double) ((Double.parseDouble(Solution2.getText())));

				Solution2.setText("0");

				MCmd=2;

				jC=1;

				Secondary=1;

						Decim=0;

		Decimalize=0;

			} catch (NumberFormatException e){

				ar1 = 0;

				Solution2.setText("0");

				MCmd=2;

				jC=1;

				Secondary=1;

						Decim=0;

		Decimalize=0;

			}

		}

		else{

			if(MCmd==1){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1+ar2;

					Solution2.setText("0");

					MCmd=2;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1+ar2;

					Solution2.setText("0");

					MCmd=2;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				}

			}

			if(MCmd==2){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1-ar2;

					Solution2.setText("0");

					MCmd=2;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1-ar2;

					Solution2.setText("0");

					MCmd=2;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				}

			}

			if(MCmd==3){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1*ar2;

					Solution2.setText("0");

					MCmd=2;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1*ar2;

					Solution2.setText("0");

					MCmd=2;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				}

			}

			if(MCmd==4){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1/ar2;

					Solution2.setText("0");

					MCmd=2;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1/ar2;

					Solution2.setText("0");

					MCmd=2;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				}

			}

		}

    }

}


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

	try{

		ar3 = (double) ((Double.parseDouble(Solution2.getText())));

		ar3= Math.sqrt(ar3);

		Solution2.setText("" + ar3);

	} catch (NumberFormatException e){


	}

}



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

    if(Ps==0){

		if(MCmd==0){

			try{

				ar1 = (double) ((Double.parseDouble(Solution2.getText())));

				Solution2.setText("0");

				MCmd=3;

				jC=1;

				Secondary=1;

						Decim=0;

		Decimalize=0;

				

			} catch (NumberFormatException e){

				ar1 = 0;

				Solution2.setText("0");

				MCmd=3;

				jC=1;

				Secondary=1;

						Decim=0;

		Decimalize=0;

			}

		}

		else{

			if(MCmd==1){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1+ar2;

					Solution2.setText("0");

					MCmd=3;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1+ar2;

					Solution2.setText("0");

					MCmd=3;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				}

			}

			if(MCmd==2){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1-ar2;

					Solution2.setText("0");

					MCmd=3;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1-ar2;

					Solution2.setText("0");

					MCmd=3;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				}

			}

			if(MCmd==3){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1*ar2;

					Solution2.setText("0");

					MCmd=3;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1*ar2;

					Solution2.setText("0");

					MCmd=3;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				}

			}

			if(MCmd==4){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1/ar2;

					Solution2.setText("0");

					MCmd=3;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1/ar2;

					Solution2.setText("0");

					MCmd=3;

					jC=1;

					Secondary=1;

							Decim=0;

		Decimalize=0;

				}

			}

		}

    }

}                                        


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

    if(Ps==0){

		if(MCmd==0){

			try{

				ar1 = (double) ((Double.parseDouble(Solution2.getText())));

				Solution2.setText("0");

				MCmd=4;

				jC=1;

				Secondary=1;

				Decim=0;

		Decimalize=0;

			} catch (NumberFormatException e){

				ar1 = 0;

				Solution2.setText("0");

				MCmd=4;

				jC=1;

				Secondary=1;

		Decim=0;

		Decimalize=0;

			}

		}

		else{

			if(MCmd==1){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1+ar2;

					Solution2.setText("0");

					MCmd=4;

					jC=1;

					Secondary=1;

		Decim=0;

		Decimalize=0;

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1+ar2;

					Solution2.setText("0");

					MCmd=4;

					jC=1;

					Secondary=1;

		Decim=0;

		Decimalize=0;

				}

			}

			if(MCmd==2){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1-ar2;

					Solution2.setText("0");

					MCmd=4;

					jC=1;

					Secondary=1;

		Decim=0;

		Decimalize=0;

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1-ar2;

					Solution2.setText("0");

					MCmd=4;

					jC=1;

					Secondary=1;

		Decim=0;

		Decimalize=0;

				}

			}

			if(MCmd==3){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1*ar2;

					Solution2.setText("0");

					MCmd=4;

					jC=1;

					Secondary=1;

		Decim=0;

		Decimalize=0;

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1*ar2;

					Solution2.setText("0");

					MCmd=4;

					jC=1;

					Secondary=1;

		Decim=0;

		Decimalize=0;

				}

			}

			if(MCmd==4){

				try{

					ar2 = (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar1/ar2;

					Solution2.setText("0");

					MCmd=4;

					jC=1;

					Secondary=1;

		Decim=0;

		Decimalize=0;

				} catch (NumberFormatException e){

					ar2 = 0;

					ar1=ar1/ar2;

					Solution2.setText("0");

					MCmd=4;

					jC=1;

					Secondary=1;

		Decim=0;

		Decimalize=0;

				}

			}

		}

    }

}                                      


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

    if(MCmd==0){

        ar2=0;

        ar1=0;

        jC=0;

        MCmd=0;

        JustEqualed=1;

		Decim=0;

		Decimalize=0;

    }

    if(MCmd==1){

		try{

			ar2 = (double) ((Double.parseDouble(Solution2.getText())));

			ar1=ar1+ar2;

			Solution2.setText("" + ar1);

			MCmd=0;

			jC=1;

			JustEqualed=1;

		Decim=0;

		Decimalize=0;

		} catch (NumberFormatException e){

			ar2 = 0;

			ar1=ar1+ar2;

			Solution2.setText("" + ar1);

			MCmd=0;

			jC=1;

			JustEqualed=1;

		Decim=0;

		Decimalize=0;

		}

    }

    if(MCmd==2){

		try{

			ar2 = (double) ((Double.parseDouble(Solution2.getText())));

			ar1=ar1-ar2;

			Solution2.setText("" + ar1);

			MCmd=0;

			jC=1;

			JustEqualed=1;

		Decim=0;

		Decimalize=0;

		} catch (NumberFormatException e){

			ar2 = 0;

			ar1=ar1-ar2;

			Solution2.setText("" + ar1);

			MCmd=0;

			jC=1;

			JustEqualed=1;

		Decim=0;

		Decimalize=0;

		}

    }

    if(MCmd==3){

		try{

			ar2 = (double) ((Double.parseDouble(Solution2.getText())));

			ar1=ar1*ar2;

			Solution2.setText("" + ar1);

			MCmd=0;

			jC=1;

			JustEqualed=1;

		Decim=0;

		Decimalize=0;

		} catch (NumberFormatException e){

			ar2 = 0;

			ar1=ar1*ar2;

			Solution2.setText("" + ar1);

			MCmd=0;

			jC=1;

			JustEqualed=1;

		Decim=0;

		Decimalize=0;

		}

    }

    if(MCmd==4){

		try{

			ar2 = (double) ((Double.parseDouble(Solution2.getText())));

			ar1=ar1/ar2;

			Solution2.setText("" + ar1);

			MCmd=0;

			jC=1;

			JustEqualed=1;

		Decim=0;

		Decimalize=0;

		} catch (NumberFormatException e){

			ar2 = 0;

			ar1=ar1/ar2;

			Solution2.setText("" + ar1);

			MCmd=0;

			jC=1;

			JustEqualed=1;

		Decim=0;

		Decimalize=0;

		}

    }

}                                         


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

MCmd=0;

jC=0;

ar1=0;

ar2=0;

Decim=0;

Decimalize=0;

Solution2.setText("");

}                                     


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

	try{

		MMem = (double) ((Double.parseDouble(Solution2.getText())));

	} catch (NumberFormatException e) {

		MMem = 0;

	}

}                                      


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

	try{

		MCur = (double) ((Double.parseDouble(Solution2.getText())));

		MMem = MMem+MCur;

	} catch (NumberFormatException e) {

		MCur = 0;

		MMem = MMem+MCur;

	}

}                                  


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

	try{

		MCur = (double) ((Double.parseDouble(Solution2.getText())));

		MMem = MMem-MCur;

	} catch (NumberFormatException e){

		MCur = 0;

		MMem = MMem-MCur;

	}

}                                           


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

MMem=0;

M2Mem=0;

M3Mem=0;

}                                        


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

}                                         


private void Solution2MouseClicked(java.awt.event.MouseEvent evt) {                                       

if(jC==1){

    Solution2.setText("");

}

}                                      


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

Solution2.setText("" + MMem);

}                                  


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

	try{

		ar3 = (double) ((Double.parseDouble(Solution2.getText())));

		ar1 = ar3*ar3;

		Solution2.setText("" + ar1);

		JustEqualed=1;

		Decim=0;

		Decimalize=0;

	} catch (NumberFormatException e){

		ar3 = 0;

		ar1 = ar3*ar3;

		Solution2.setText("" + ar1);

		JustEqualed=1;

		Decim=0;

		Decimalize=0;

	}

}                                    


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

	try{

		ar3 = (double) ((Double.parseDouble(Solution2.getText())));

		ar1 = ar3*ar3*ar3;

		Solution2.setText("" + ar1);

		Decim=0;

		Decimalize=0;

	} catch (NumberFormatException e) {

		ar3 = 0;

		ar1 = ar3*ar3*ar3;

		Solution2.setText("" + ar1);

		Decim=0;

		Decimalize=0;

	}

}                                   


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

	try{

		ar3=Math.PI;

		Solution2.setText("" + ar3);

		Decim=0;

		Decimalize=0;

	} catch (NumberFormatException e){

		ar3=Math.PI;

		Solution2.setText("" + ar3);

		Decim=0;

		Decimalize=0;

	}

}                                  


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

	try{

		M2Mem= (double) ((Double.parseDouble(Solution2.getText())));

	} catch (NumberFormatException e){

		M2Mem= 0;

	}

}                                       


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

	try{

		M3Mem= (double) ((Double.parseDouble(Solution2.getText())));

	} catch (NumberFormatException e){

		M3Mem= 0;

	}

}                                     


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

Solution2.setText("" + M2Mem);

}                                         


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

	try{

		ar3= (double) ((Double.parseDouble(Solution2.getText())));

		Percent=ar3/100;

		Solution2.setText("" + Percent);

		JustEqualed=1;

		Decim=0;

		Decimalize=0;

	} catch (NumberFormatException e){

		ar3= 0;

		Percent=ar3/100;

		Solution2.setText("" + Percent);

		JustEqualed=1;

		Decim=0;

		Decimalize=0;

	}

}

		


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

Solution2.setText("" + M3Mem);


}         

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

		if(Secondary==0){

			try{

				ar3= (double) ((Double.parseDouble(Solution2.getText())));

				ar1=ar3*-1;

				Solution2.setText("" + ar1);

			} catch (NumberFormatException e){

				ar1=0;

				Solution2.setText("" + ar1);

			}

		}

		else if(Secondary==1){

			try{

				ar3= (double) ((Double.parseDouble(Solution2.getText())));

				ar2=ar3*-1;

				Solution2.setText("" + ar2);

			} catch (NumberFormatException e){

				ar2=0;

				Solution2.setText("" + ar2);

			}

		}

	}

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

		if(Decimalize==0){

			Decimalize=1;

			Decimal2=10;

			try{

			ar3= (double) ((Double.parseDouble(Solution2.getText())));

			Decimal1=ar3;

			} catch (NumberFormatException e){

			ar3= 0;

			Decimal1=ar3;

			}

		}

	}

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

		if(Decimalize==0){

		if(JustEqualed==1){

			Solution2.setText("0");

			JustEqualed=0;

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

					ar3= 0;

					ar2=ar3*10;

					Solution2.setText("" + ar2);

				}

			}

		}

		else{

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

					ar3= 0;

					ar2=ar3*10;

					Solution2.setText("" + ar2);

				}

			}

		}

	}

	else if(Decimalize==1){

		try{

			ar3= (double) ((Double.parseDouble(Solution2.getText())));

		} catch (NumberFormatException e){

			ar3=0;

		}

		ar3=ar3*Decimal2;

		ar3=ar3/Decimal2;

		Decimal2=Decimal2*10;

		Solution2.setText("" + ar3);

	}

	}


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

	if(Decimalize==0){

    if(JustEqualed==1){

		Solution2.setText("0");

		JustEqualed=0;

		if(Secondary==0){

			try{

				ar3= (double) ((Double.parseDouble(Solution2.getText())));

				ar1=ar3*10+1;

				Solution2.setText("" + ar1);

			} catch (NumberFormatException e){

				ar3= 0;

				ar1=ar3*10+1;

				Solution2.setText("" + ar1);

			}

		}

		else if(Secondary==1){

			try{

				ar3= (double) ((Double.parseDouble(Solution2.getText())));

				ar2=ar3*10+1;

				Solution2.setText("" + ar2);

			} catch (NumberFormatException e){

				ar3= 0;

				ar2=ar3*10+1;

				Solution2.setText("" + ar2);

			}

		}

		}

		else{

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10+1;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10+1;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10+1;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

				ar3= 0;

				ar2=ar3*10+1;

				Solution2.setText("" + ar2);

			}

		}

		}

	}

	else if(Decimalize==1){

		try{

			ar3= (double) ((Double.parseDouble(Solution2.getText())));

		} catch (NumberFormatException e){

			ar3=0;

		}

		ar3=ar3*Decimal2;

		ar3=ar3+1;

		ar3=ar3/Decimal2;

		Decimal2=Decimal2*10;

		Solution2.setText("" + ar3);

	}

	}


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

		if(Decimalize==0){

		if(JustEqualed==1){

			Solution2.setText("0");

			JustEqualed=0;

		if(Secondary==0){

			try{

				ar3= (double) ((Double.parseDouble(Solution2.getText())));

				ar1=ar3*10+3;

				Solution2.setText("" + ar1);

			} catch (NumberFormatException e){

				ar3= 0;

				ar1=ar3*10+3;

				Solution2.setText("" + ar1);

			}

		}

		else if(Secondary==1){

			try{

				ar3= (double) ((Double.parseDouble(Solution2.getText())));

				ar2=ar3*10+3;

				Solution2.setText("" + ar2);

			} catch (NumberFormatException e){

				ar3= 0;

				ar2=ar3*10+3;

				Solution2.setText("" + ar2);

			}

		}

		}

		else{

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10+3;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10+3;

					Solution2.setText("" + ar1);

				}

			}

		else if(Secondary==1){

			try{

				ar3= (double) ((Double.parseDouble(Solution2.getText())));

				ar2=ar3*10+3;

				Solution2.setText("" + ar2);

			} catch (NumberFormatException e){

				ar3= 0;

				ar2=ar3*10+3;

				Solution2.setText("" + ar2);

			}

		}

		}

    }

	else if(Decimalize==1){

		try{

			ar3= (double) ((Double.parseDouble(Solution2.getText())));

		} catch (NumberFormatException e){

			ar3=0;

		}

		ar3=ar3*Decimal2;

		ar3=ar3+3;

		ar3=ar3/Decimal2;

		Decimal2=Decimal2*10;

		Solution2.setText("" + ar3);

	}

	}


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

		if(Decimalize==0){

		if(JustEqualed==1){

			Solution2.setText("0");

			JustEqualed=0;

		if(Secondary==0){

			try{

				ar3= (double) ((Double.parseDouble(Solution2.getText())));

				ar1=ar3*10+2;

				Solution2.setText("" + ar1);

			} catch (NumberFormatException e){

				ar3= 0;

				ar1=ar3*10+2;

				Solution2.setText("" + ar1);

			}

		}

		else if(Secondary==1){

			try{

				ar3= (double) ((Double.parseDouble(Solution2.getText())));

				ar2=ar3*10+2;

				Solution2.setText("" + ar2);

			} catch (NumberFormatException e){

				ar3= 0;

				ar2=ar3*10+2;

				Solution2.setText("" + ar2);

			}

		}

		}

		else{

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10+2;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10+2;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10+2;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

					ar3= 0;

					ar2=ar3*10+2;

					Solution2.setText("" + ar2);

				}

			}

		}

    }

	else if(Decimalize==1){

		try{

			ar3= (double) ((Double.parseDouble(Solution2.getText())));

		} catch (NumberFormatException e){

			ar3=0;

		}

		ar3=ar3*Decimal2;

		ar3=ar3+2;

		ar3=ar3/Decimal2;

		Decimal2=Decimal2*10;

		Solution2.setText("" + ar3);

	}

	}


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

		if(Decimalize==0){

		if(JustEqualed==1){

			Solution2.setText("0");

			JustEqualed=0;

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10+4;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10+4;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10+4;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

					ar3= 0;

					ar2=ar3*10+4;

					Solution2.setText("" + ar2);

				}

			}

		}

		else{

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10+4;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10+4;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10+4;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

					ar3= 0;

					ar2=ar3*10+4;

					Solution2.setText("" + ar2);

				}

			}

		}

	}

	else if(Decimalize==1){

		try{

			ar3= (double) ((Double.parseDouble(Solution2.getText())));

		} catch (NumberFormatException e){

			ar3=0;

		}

		ar3=ar3*Decimal2;

		ar3=ar3+4;

		ar3=ar3/Decimal2;

		Decimal2=Decimal2*10;

		Solution2.setText("" + ar3);

	}

	}


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

		if(Decimalize==0){

		if(JustEqualed==1){

			Solution2.setText("0");

			JustEqualed=0;

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10+5;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10+5;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10+5;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

					ar3= 0;

					ar2=ar3*10+5;

					Solution2.setText("" + ar2);

				}

			}

		}

		else{

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10+5;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10+5;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10+5;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

					ar3= 0;

					ar2=ar3*10+5;

					Solution2.setText("" + ar2);

				}

			}

		}

	}

	else if(Decimalize==1){

		try{

			ar3= (double) ((Double.parseDouble(Solution2.getText())));

		} catch (NumberFormatException e){

			ar3=0;

		}

		ar3=ar3*Decimal2;

		ar3=ar3+5;

		ar3=ar3/Decimal2;

		Decimal2=Decimal2*10;

		Solution2.setText("" + ar3);

	}

	}


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

		if(Decimalize==0){

		if(JustEqualed==1){

			Solution2.setText("0");

			JustEqualed=0;

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10+6;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10+6;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10+6;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

					ar3= 0;

					ar2=ar3*10+6;

					Solution2.setText("" + ar2);

				}

			}

		}

		else{

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10+6;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10+6;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10+6;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

					ar3= 0;

					ar2=ar3*10+6;

					Solution2.setText("" + ar2);

				}

			}

		}

    }

	else if(Decimalize==1){

		try{

			ar3= (double) ((Double.parseDouble(Solution2.getText())));

		} catch (NumberFormatException e){

			ar3=0;

		}

		ar3=ar3*Decimal2;

		ar3=ar3+6;

		ar3=ar3/Decimal2;

		Decimal2=Decimal2*10;

		Solution2.setText("" + ar3);

	}

	}


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

		if(Decimalize==0){

		if(JustEqualed==1){

			Solution2.setText("0");

			JustEqualed=0;

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10+7;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10+7;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10+7;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

					ar3= 0;

					ar2=ar3*10+7;

					Solution2.setText("" + ar2);

				}

			}

		}

		else{

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10+7;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10+7;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10+7;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

					ar3= 0;

					ar2=ar3*10+7;

					Solution2.setText("" + ar2);

				}

			}

		}

    }

	else if(Decimalize==1){

		try{

			ar3= (double) ((Double.parseDouble(Solution2.getText())));

		} catch (NumberFormatException e){

			ar3=0;

		}

		ar3=ar3*Decimal2;

		ar3=ar3+7;

		ar3=ar3/Decimal2;

		Decimal2=Decimal2*10;

		Solution2.setText("" + ar3);

	}

	}


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

		if(Decimalize==0){

		if(JustEqualed==1){

			Solution2.setText("0");

			JustEqualed=0;

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10+8;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10+8;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10+8;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

					ar3= 0;

					ar2=ar3*10+8;

					Solution2.setText("" + ar2);

				}

			}

		}

		else{

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10+8;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10+8;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10+8;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

					ar3= 0;

					ar2=ar3*10+8;

					Solution2.setText("" + ar2);

				}

			}

		}

    }

	else if(Decimalize==1){

		try{

			ar3= (double) ((Double.parseDouble(Solution2.getText())));

		} catch (NumberFormatException e){

			ar3=0;

		}

		ar3=ar3*Decimal2;

		ar3=ar3+8;

		ar3=ar3/Decimal2;

		Decimal2=Decimal2*10;

		Solution2.setText("" + ar3);

	}

	}


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

		if(Decimalize==0){

		if(JustEqualed==1){

			Solution2.setText("0");

			JustEqualed=0;

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10+9;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10+9;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10+9;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

					ar3= 0;

					ar2=ar3*10+9;

					Solution2.setText("" + ar2);

				}

			}

		}

		else{

			if(Secondary==0){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar1=ar3*10+9;

					Solution2.setText("" + ar1);

				} catch (NumberFormatException e){

					ar3= 0;

					ar1=ar3*10+9;

					Solution2.setText("" + ar1);

				}

			}

			else if(Secondary==1){

				try{

					ar3= (double) ((Double.parseDouble(Solution2.getText())));

					ar2=ar3*10+9;

					Solution2.setText("" + ar2);

				} catch (NumberFormatException e){

					ar3= 0;

					ar2=ar3*10+9;

					Solution2.setText("" + ar2);

				}

			}

		}

    }

	else if(Decimalize==1){

		try{

			ar3= (double) ((Double.parseDouble(Solution2.getText())));

		} catch (NumberFormatException e){

			ar3=0;

		}

		ar3=ar3*Decimal2;

		ar3=ar3+9;

		ar3=ar3/Decimal2;

		Decimal2=Decimal2*10;

		Solution2.setText("" + ar3);

	}

	}


    public static void main(String args[]) {        

        try {

            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

                if ("Nimbus".equals(info.getName())) {

                    javax.swing.UIManager.setLookAndFeel(info.getClassName());

                    break;

                }

            }

        } catch (ClassNotFoundException ex) {

            java.util.logging.Logger.getLogger(SuperCalc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        } catch (InstantiationException ex) {

            java.util.logging.Logger.getLogger(SuperCalc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        } catch (IllegalAccessException ex) {

            java.util.logging.Logger.getLogger(SuperCalc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        } catch (javax.swing.UnsupportedLookAndFeelException ex) {

            java.util.logging.Logger.getLogger(SuperCalc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        }

        java.awt.EventQueue.invokeLater(new Runnable() {


            

            public void run() {

                new SuperCalc().setVisible(true);

            }

        });

    }

    public javax.swing.JButton CmdEquals;

    public javax.swing.JButton Cube;

    public javax.swing.JButton Devide;

    public javax.swing.JButton DisplayM2;

    public javax.swing.JComboBox Formula;

    public javax.swing.JButton MD;

    public javax.swing.JButton Minus;

    public javax.swing.JButton Multiply;

    public javax.swing.JButton Num0;

    public javax.swing.JButton Num1;

    public javax.swing.JButton Num2;

    public javax.swing.JButton Num3;

    public javax.swing.JButton Num4;

    public javax.swing.JButton Num5;

    public javax.swing.JButton Num6;

    public javax.swing.JButton Num7;

    public javax.swing.JButton Num8;

    public javax.swing.JButton Num9;

    public javax.swing.JButton Pluss;

    public javax.swing.JTextField Solution2;

    public javax.swing.JButton Sqrd;

    public javax.swing.JButton addMem;

    public javax.swing.JButton clear;

    public javax.swing.JButton clearMem;

    public javax.swing.JLabel jLabel1;

    public javax.swing.JScrollPane jScrollPane1;

    public javax.swing.JTextField jTextField1;

    public javax.swing.JTextPane jTextPane1;

    public javax.swing.JButton pI;

    public javax.swing.JButton setM3;

    public javax.swing.JButton setMem;

    public javax.swing.JButton setMem2;

    public javax.swing.JButton subtractMem;

    public javax.swing.JButton useM3;

	public javax.swing.JButton DecimalPlace;

	public javax.swing.JButton Negative;

	public javax.swing.JButton AreaCir;

	public javax.swing.JButton PercentButton;

	public javax.swing.JButton SquareRootDo;

}


#2
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
Well, you can't expect generated code to be good eh.
-variables shouldn't start with a capital letter
-too much repetitive code
-too much in 1 class.
-using double in a calculator will lead to incorrect results.

Something like this would be prettier:
package prettycalc;


import prettycalc.controller.InputController;


import javax.swing.*;
import java.awt.*;


public class PrettyCalc extends JFrame {
    private JButton[] memoryButtons;
    private JButton[] inputButtons;
    private JButton[] operationButtons;
    private JComboBox formulaBox;
    private JLabel formulaLabel;
    private JTextField inputField;
    private InputController inputController;


    public PrettyCalc() {
        super("pretty calc");
        initComponents();
        makeLayout();
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }


    private void initComponents() {
        String[] memory = new String[]{"M1", "M2", "M3", "M1=", "M2=", "M3=", "Clear M"};
        String[] input = new String[]{"7", "8", "9", "4", "5", "6", "1", "2", "3", ".", "0", "+/-"};
        String[] operations = new String[]{"+", "-", "*", "/", "x\u00B2", "x\u00B3", "pl", "ar", "%", "\u221A", "Clear", "="};


        memoryButtons = new JButton[memory.length];
        for (int i = 0; i < memory.length; i++) {
            memoryButtons[i] = new JButton(memory[i]);
        }


        inputController = new InputController(this);
        inputButtons = new JButton[input.length];
        for (int i = 0; i < input.length; i++) {
            JButton inputButton = new JButton(input[i]);
            inputButton.addActionListener(inputController);
            inputButtons[i] = inputButton;
        }


        operationButtons = new JButton[operations.length];
        for (int i = 0; i < operations.length; i++) {
            operationButtons[i] = new JButton(operations[i]);
        }


        formulaBox = new JComboBox(new String[]{"No formula", "volume cube = length * length * length"});
        formulaLabel = new JLabel("Formulas");
        inputField = new JTextField();
    }


    private void makeLayout() {
        JPanel northFlowPanel = new JPanel();
        northFlowPanel.add(formulaBox);
        northFlowPanel.add(formulaLabel);


        JPanel northPanel = new JPanel(new GridLayout(0, 1, 9, 9));
        northPanel.add(northFlowPanel);
        northPanel.add(inputField);


        JPanel inputPanel = new JPanel(new GridLayout(0, 4, 9, 9));
        int i = 1;
        for (JButton inputButton : inputButtons) {
            if (i++ % 4 == 0) {
                inputPanel.add(Box.createGlue());
                i++;
            }
            inputPanel.add(inputButton);
        }


        JPanel memoryPanel = new JPanel(new GridLayout(0, 4, 9, 9));
        i = 1;
        for (JButton memoryButton : memoryButtons) {
            if (i++ % 4 == 0) {
                memoryPanel.add(Box.createGlue());
                i++;
            }
            memoryPanel.add(memoryButton);
        }


        JPanel operationPanel = new JPanel(new GridLayout(0, 2, 9, 9));
        operationPanel.add(Box.createGlue());
        operationPanel.add(Box.createGlue());


        for (JButton operationButton : operationButtons) {
            operationPanel.add(operationButton);
        }


        JPanel centerPanel = new JPanel();
        centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS));
        centerPanel.add(memoryPanel);
        centerPanel.add(Box.createGlue());
        centerPanel.add(inputPanel);


        add(centerPanel);
        add(operationPanel, BorderLayout.EAST);
        add(northPanel, BorderLayout.NORTH);


        setSize(500, 500);
    }


    public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, IllegalAccessException, InstantiationException {
        for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
        new PrettyCalc().setVisible(true);
    }


    public void setInput(String input) {
        inputField.setText(input);
    }
}



package prettycalc.controller;


import prettycalc.view.PrettyCalc;


import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.math.BigDecimal;


public class InputController implements ActionListener{
    private BigDecimal number;
    private PrettyCalc prettyCalc;
    private boolean decimalPlaced;


    public InputController(PrettyCalc prettyCalc) {
        this.prettyCalc = prettyCalc;
        number = new BigDecimal("0");
    }


    public void actionPerformed(ActionEvent e) {
        String input = ((JButton)e.getSource()).getText();
        if(input.equals(".")){
            if(decimalPlaced){
                return;
            } else {
                decimalPlaced = !decimalPlaced;
                input = ".0";
            }
        }
        if(input.equals("+/-")){
            number = number.multiply(new BigDecimal("-1"));
        } else {
            number = new BigDecimal(number.toPlainString() + input);
        }
        prettyCalc.setInput(number.toPlainString());
    }


    public BigDecimal getNumber() {
        return number;
    }
}



Organized like
Attached File  2012-01-20_094248.png   2.31K   6 downloads
Looking like
Attached File  calc.png   37.54K   5 downloads

Edited by wim DC, 20 January 2012 - 01:20 AM.


#3
fread

fread

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 787 posts
Thats a pretty huge class :D
Perfection of means and confusion of ends seem to characterize our age. Albert Einstein :confused:




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users