import java.applet.*; import java.awt.*; public class Geom1 extends Applet { private int angl=360; private int last_x=0; private int last_y=0; private Color current_color=Color.black; private Button clear_button; private Choice color_choices; private Choice arc_choices; private Button square_button; private Button circ_button; private Button choose_button; public class point implements Cloneable{ public int x; public int y; public Object clone(){ //begin clone try{ //begin try return super.clone(); } //end try catch(CloneNotSupportedException e){ // begin catch return null; //if there is a catch } //end catch } //end cloning structure for point } //end point def public class Vcirc implements Cloneable{ public point c=new point(); public point v=new point(); public int s; public Object clone(){ //begin clone try{ //begin try Vcirc vc=(Vcirc)super.clone(); vc.c=(point)c.clone(); vc.v=(point)v.clone(); return vc; } catch(CloneNotSupportedException e){ return null; }//end catch } //end cloning structure for virtual circle c is center, v is vector } //end virtual circle def public Vcirc circ1=new Vcirc(); public boolean choose=false; //init applet public void init(){ //set backgd color this.setBackground(Color.white); //create a restart button clear_button=new Button("Clear"); clear_button.setForeground(Color.black); clear_button.setBackground(Color.lightGray); this.add(clear_button); //create a choose button choose_button=new Button("Choose"); choose_button.setForeground(Color.black); choose_button.setBackground(Color.lightGray); this.add(choose_button); //create square button square_button=new Button("Square"); square_button.setForeground(Color.black); square_button.setBackground(Color.lightGray); this.add(square_button); //create circle button circ_button=new Button("Circle"); circ_button.setForeground(Color.black); circ_button.setBackground(Color.lightGray); this.add(circ_button); //create menu of colors color_choices=new Choice(); color_choices.addItem("black"); color_choices.addItem("red"); color_choices.addItem("blue"); color_choices.addItem("green"); color_choices.addItem("yellow"); color_choices.setForeground(Color.black); color_choices.setBackground(Color.lightGray); this.add(new Label("Color:")); this.add(color_choices); } //end init applet //called when mouse click public boolean mouseDown(Event e, int x, int y){ last_x=x; last_y=y; if (choose){ if((circ1.c.x-3