1. Create an applet that will draw a set of ovals, where theuser can specify the
ID: 3609586 • Letter: 1
Question
1. Create an applet that will draw a set of ovals, where theuser can specify the number of ovals. . 2. Create an applet to draw a digit using the methodfillRect of theclass Graphics. For instance, if the input is 6,the applet will display the digit 6. 1. Create an applet that will draw a set of ovals, where theuser can specify the number of ovals. . 2. Create an applet to draw a digit using the methodfillRect of theclass Graphics. For instance, if the input is 6,the applet will display the digit 6.Explanation / Answer
public class NewAppletextends Applet {
int width,height;
public voidinit() {
width = getSize().width;
height = getSize().height;
setBackground( Color.black );
}
public voidpaint( Graphics g ) {
g.setColor( Color.green );
g.setColor( Color.green );
for ( int i = 0; i< 6; i++ ) {
g.drawOval(30,30+(100*i),30,30 );
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.