public class lab7 extends Applet implements Runnable, KeyListener, ActionListener{
public int w=1500;
public int h=800;
public double xB[]={6.5, -6.5, -6.5, 6.5};
public double yB[]={6.5, 6.5, -6.5, -6.5};
public double xN1[]=new double[xB.length];
public double yN1[]=new double[yB.length];
public int xN2[]=new int[xB.length];
public int yN2[]=new int[yB.length];
}
public void keyPressed(KeyEvent e) {
int m=e.getKeyCode();
if (m==e.VK_ESCAPE){
step=0;
if (!b){
th=new Thread(this); b=false;
th.stop();
}
}
else if (m==e.VK_ENTER){
alpha=0;
if (!b){
th=new Thread(this); b=true;
th.start();
}
}
else if (m==e.VK_UP) step-=1.0;
else if (m==e.VK_DOWN) step+=1.0;
}
public void keyReleased(KeyEvent arg0) {
// TODO Auto-generated method stub
}
public void keyTyped(KeyEvent arg0) {
// TODO Auto-generated method stub
}
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals(«По часовой стрелке»)){
alpha=0;
if (!b){
th=new Thread(this); b=true;
th.start();
}
if (step<0) step=-step;
}
else if(e.getActionCommand().equals(«Против часовой стрелки»)){
alpha=0;
if (!b){
th=new Thread(this); b=true;
th.start();
}
if (step>=0) step=-step;
}
else if(e.getActionCommand().equals(«Стоп»)){
step=0;
if (!b){
th=new Thread(this); b=false;
th.stop();
}
//if (step>=0) step=-step;
}
//repaint();
}
}