Advertisement
shorti

Untitled

May 20th, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. import java.awt.Font;
  2. import java.awt.Graphics;
  3. import java.awt.Graphics2D;
  4. import java.awt.Color;
  5.  
  6. import javax.swing.JFrame;
  7. import javax.swing.JPanel;
  8. import javax.swing.JTextArea;
  9.  
  10. public class MoveWord extends JPanel{
  11.     int x = 40, y = 20;
  12.  
  13.     public void paint(Graphics g)
  14.     {
  15.        
  16.         super.paint(g);
  17.         Graphics2D graficArea = (Graphics2D)g;
  18.         Font font = new Font("Tahoma",Font.BOLD+Font.PLAIN,18);
  19.         graficArea.setFont(font);
  20.         graficArea.setColor(Color.black);
  21.         graficArea.drawString("a",x,y);
  22.        
  23.         try {
  24.             Thread.sleep (150);
  25.         } catch (Exception e) {}
  26.        
  27.         y+=2;
  28.        
  29.         if (y == 100) {
  30.             y = 0;
  31.         }
  32.         repaint();
  33.     }
  34.    
  35.     public static void main(String[] args) {
  36.         JFrame JF = new JFrame ("Изток");
  37.         JF.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
  38.         JF.setSize (200,400);
  39.         JF.add (new MoveWord());
  40.         JF.setVisible (true);
  41.     }
  42.    
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement