// StringStat.java // Draw Rolling String // by nagatani@eken.phys.nagoya-u.ac.jp import java.applet.Applet; import java.awt.*; public class StringStat implements SGObject { int xWindow, yWindow; Image imageString; int xImage, yImage; StringStat (Image imageString, Applet applet) { this.imageString = imageString; this.xWindow = applet.size().width; this.yWindow = applet.size().height; int xImage = 1026, yImage = 417; // Default Image Size for (int n = 0 ; n < 10 ; n++) { int x = imageString.getWidth (applet), y = imageString.getHeight (applet); if (x > 0 && y > 0 ) { xImage = x; yImage = y; break; } try { Thread.sleep (100); // 100 ms Delay Time } catch (InterruptedException e) {} } this.xImage = xImage; this.yImage = yImage; } public void paint (Graphics g, Applet applet) { g.drawImage (imageString, (xWindow - xImage)/2, (yWindow - yImage)/2, applet); } public void move () { } }