import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.*;
import javax.swing.JPanel;
public class TextMove2 extends JPanel {
int x = 0;
int y = 100;
/**
* Create the panel.
*/
public TextMove2() {
}
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2 = (Graphics2D)g;
Font font = new Font("Tahoma",Font.BOLD+Font.PLAIN,100);
g2.setFont(font);;
g2.setColor(Color.red);
g2.drawString("EAST", x, y);;
try {
Thread.sleep(100);
}
catch(Exception ex) {}
x+=10;
if(x>this.getWidth()) {
x = 0;
}
repaint();
}
public static void main(String[] args) {
JFrame jf = new JFrame("EAST");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
jf.add(new TextMove2());
jf.setVisible(true);
}
}