Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Color;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.JTextArea;
- public class MoveWord extends JPanel{
- int x = 40, y = 20;
- public void paint(Graphics g)
- {
- super.paint(g);
- Graphics2D graficArea = (Graphics2D)g;
- Font font = new Font("Tahoma",Font.BOLD+Font.PLAIN,18);
- graficArea.setFont(font);
- graficArea.setColor(Color.black);
- graficArea.drawString("a",x,y);
- try {
- Thread.sleep (150);
- } catch (Exception e) {}
- y+=2;
- if (y == 100) {
- y = 0;
- }
- repaint();
- }
- public static void main(String[] args) {
- JFrame JF = new JFrame ("Изток");
- JF.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
- JF.setSize (200,400);
- JF.add (new MoveWord());
- JF.setVisible (true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement