Files
wscience/src/awt/Banner.java

47 lines
1.2 KiB
Java

package awt;
/*************************************************************************
* Compilation: javac Banner.java
* Execution: java Banner s
* Dependencies: StdDraw.java
*
* Plots the String s, and moves it across the screen, left-to-right,
* wrapping around when it reaches the border.
*
* % java Banner "Hello, World"
*
*
*************************************************************************/
import java.awt.Font;
import stdlib.Color;
import stdlib.StdDraw;
public class Banner {
public static void main(String[] args) {
// String s = args[0];
String s = "Hello World";
StdDraw sd = new StdDraw();
// remove the 5% border
sd.setXscale(1.0/22.0, 21.0/22.0);
sd.setYscale(1.0/22.0, 21.0/22.0);
// set the font
Font f = new Font("Arial", Font.BOLD, 60);
StdDraw.setFont(f);
sd.setPenColor(Color.WHITE);
for (double i = 0.0; true; i += 0.01) {
StdDraw.clear(StdDraw.getClearColor());
StdDraw.text((i % 1.0), 0.5, s);
StdDraw.text((i % 1.0) - 1.0, 0.5, s);
StdDraw.text((i % 1.0) + 1.0, 0.5, s);
sd.show(60);
}
}
}