// "Counter2.java" Java Counter2 Ver1.10 1999,Feb,06 // copyright: Hiroyuki Murata import java.applet.Applet; import java.awt.*; import java.io.*; import java.net.URL; public class Counter2 extends Applet implements Runnable { int digit, // Counter Digit digMarX, // X Digit Margin digMarY, // Y Digit Margin numSizX, // X Numeric Size numSizY // Y Numeric Size ; static final int appMarX = 4, // X Applet Margin appMarY = 4 // Y Applet Margin ; Color bgColor, // background color f0Color, // frame color (dark) f1Color // frame color (light) ; MediaTracker tracker; Thread thread = null; boolean inited = false; int numStepX; int offsetX; int imgStepX, imgOsX, imgOsY; Image iorigin, iroll, ioff; Graphics groll, goff; Graphics[] gsub; Motionc2[] mv; //----------------------------------------------------------- public void init() { inited = false; String strCount_ = getParameter("count"); if (strCount_ == null) strCount_ = getParamStr("name", "0"); String imagefile = getParamStr("image", "jnum.jpg"); digit = getParamInt("digit", 4); digMarX = getParamInt("digmarx", 0); digMarY = getParamInt("digmary", 2); bgColor = getParamCol("bgcolor", 0); f0Color = getParamCol("f0color", 0x808080); f1Color = getParamCol("f1color", 0xe0e0e0); numSizX = getParamInt("numsizx", 40); numSizY = getParamInt("numsizy", 40); imgStepX = getParamInt("imgstepx", numSizX); imgOsX = getParamInt("imgosx", 0); imgOsY = getParamInt("imgosy", 0); gsub = new Graphics[digit]; mv = new Motionc2[digit]; for (int i=0; i=0) ? fMinDist : (fMinDist + 10.0); double BrkTime = Dist * 2.0 / fSpeed; // braking time subSpeed = fSpeed / BrkTime; } public double go() { if (brake) { fSpeed -= subSpeed; if (fSpeed<=0.0) { fSpeed = 0.0; brake = false; still = true; } } if (!still) { fN += fSpeed; if (fN >= 10.0) { fN -= 10.0; } } return fN; } } /*************************************************************************/