import javax.swing.*;
import BreezySwing.*;
public class piGUI extends GBFrame{
// beginning of class
private JLabel iterationLabel;
private JLabel numberLabel;
private DoubleField iterationField;
private DoubleField numberField;
private JButton iterationButton;
private JButton numberButton;
private double extent = iteration.getnumber();
public piGUI(){
// beginning of constructor
iterationLabel = addLabel ("Iterations" ,1,1,1,1);
numberLabel = addLabel ("Pi" ,1,2,1,1);
iterationField = addDoubleField (0.0 ,2,1,1,1);
numberField = addDoubleField (0.0 ,2,2,1,1);
iterationButton = addButton (">>>>>" ,3,1,1,1);
} // end of constructor
public void buttonClicked (JButton buttonObj){
// beginning of method
for (int i=1; i < extent; i++) {
// beginning of for
if(answer % 2 == 1)
{ // beginning of if
extent=extent-1.0/(2*i-1);
answer=answer+1;
} // end of if
else
{ // beginning of else
extent=extent+1.0/(2*i-1);
answer=answer+1;
answer = answer * 4;
} // end of else
} // end of for
} // end of method
private double answer = numberField.setnumber(end);
public static void main (String[] args){ // beginning of main
piGUI theGUI = new piGUI();
theGUI.setSize (250, 100);
theGUI.setVisible(true);
} // end of main
} // end of class