/* <applet code="ConCirc" height=1000 width=1000> </applet> */
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class ConCirc extends Applet implements ActionListener
{
TextField text1,text2;
int c;
String d;
public void init()
{
setLayout(null);
text1= new TextField(20);
text1.setBounds(150,50,40,20);
add(text1);
text1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
repaint();
}
public void paint(Graphics g)
{
int n;
String str;
int x=300,y=300,w=100;
g.drawString("Input value for n:",50,60);
str=text1.getText();
n=Integer.parseInt(str);
for(int i=0;i<n;i++)
{
g.setColor(Color.blue);
g.drawOval(x,y,w,w);
x=x-10;
y=y-10;
w=w+20;
}
}
}
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class ConCirc extends Applet implements ActionListener
{
TextField text1,text2;
int c;
String d;
public void init()
{
setLayout(null);
text1= new TextField(20);
text1.setBounds(150,50,40,20);
add(text1);
text1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
repaint();
}
public void paint(Graphics g)
{
int n;
String str;
int x=300,y=300,w=100;
g.drawString("Input value for n:",50,60);
str=text1.getText();
n=Integer.parseInt(str);
for(int i=0;i<n;i++)
{
g.setColor(Color.blue);
g.drawOval(x,y,w,w);
x=x-10;
y=y-10;
w=w+20;
}
}
}
No comments :
Post a Comment