0

Hi I am trying to implement RadioButtons which is a subclass of GUIelements. In the drawing part I was asked to override the superclass draw method and draw a circle . It should also draw its text just to the right of the button and I was asked to leave a space between the button and the text. How do I leave a blank space here . So far I was able to write this.

public class RadioButton extends GUIelements {

    public RadioButton(xc,yc,radius,title,hilite,g){
        super(xc,yc,radius,title,hilite,g);
    }
    public void draw(){
     StdDraw.setPenColor(StdDraw.WHITE);
     StdDraw.filledCircle(xc,yc,radius);
     StdDraw.setPenColor(StdDraw.BLACK);
     StdDraw.setPenRadius();
     StdDraw.circle(xc,yc,radius);
     StdDraw.textLeft(xc,yc,String);
}
Madhawa Priyashantha
  • 9,633
  • 7
  • 33
  • 60
  • Add some value to `xc` when drawing the text? Your code wouldn't compile as it is (or at least it looks like that since `String` is a class) but besides that you'll probably also want to check whether the button has been checked before drawing the inner circle. – Thomas Mar 16 '16 at 16:06
  • Thanks for bringing out the problem , It should be title not String. – Kaiser Hasan Mar 16 '16 at 16:37

0 Answers0