Академический Документы
Профессиональный Документы
Культура Документы
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.applet.*;
g = can.getGraphics();
dbi = createImage(W,H);
dbg = dbi.getGraphics();
}
x = amp*Math.exp(-0.1*fr*step*dt)*Math.cos(w*step*dt); //new x
length = W/2-10;
px = (int)Math.round((double)W/2 + (length-40)*x); //mass position
currentLength1 = px-20;
currentLength2 = W-px-20;
d1 = currentLength1/16.;
d2 = currentLength2/16.;
g.drawImage(dbi,0,0,this);
}//paint()
if(evt.getActionCommand() == plus.getActionCommand())
{
k= k*2; intial(); paint(); start();
}
if(evt.getActionCommand() == min.getActionCommand())
{
k = k/2; intial(); paint(); start();
}
if(evt.getActionCommand() == plus2.getActionCommand())
{
fr++; intial(); paint(); start();
}
if(evt.getActionCommand() == min2.getActionCommand())
{
if(x > 0)
{ fr--; intial(); paint(); start(); }
}
}//actionPerformed()