import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class p7 extends Applet implements ActionListener
{
Button b1=new Button("ADD");
Label l1 =new Label("ENTER VALUE");
TextField t1=new TextField(10);
public void init()
{
t1.setText("3");
add(l1);
add(t1);
add(b1);
b1.addActionListener(this);
}
int numberofpoints = 8;
public void paint(Graphics g)
{
int x[] = { 40,80,110,110,80,40,13,13};
int y[] = { 13,13,40,80,110,110,80,40 };
g.setColor(Color.blue);
g.drawPolygon(x, y, numberofpoints);
}
public void actionPerformed(ActionEvent ae)
{
int v1=Integer.parseInt(t1.getText());
numberofpoints=v1;
repaint();
}
}
/*
< html>
< body>
< applet code="p7.class" width="300" height="300">
< /applet>
< /body>
< /html>
*/