document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import java.awt.*;
  2. import java.awt.event.ActionEvent;
  3. import java.awt.event.ActionListener;
  4. import java.awt.image.*;
  5.  
  6. import javax.swing.*;
  7.  
  8. @SuppressWarnings("serial")
  9. public class Applet2018a extends JApplet implements ActionListener {
  10.     JPanel controlPanel;
  11.     int x = 0;
  12.     int fps = 24;
  13.     Timer timer = new Timer(1000 / fps, this);
  14.     JPanel drawPanel = new JPanel() {
  15.         @Override
  16.         public void paint(Graphics g) {
  17.             BufferedImage image =
  18.                     new BufferedImage(drawPanel.getWidth(),
  19.                             drawPanel.getHeight(),
  20.                             BufferedImage.TYPE_INT_RGB);
  21.             Graphics g2 = image.getGraphics();
  22.             g2.setColor(Color.CYAN);
  23.             g2.fillRect(0, 0, drawPanel.getWidth(), drawPanel.getHeight());
  24.             g2.setColor(Color.BLACK);
  25.             for (int i = 0; i < 80; i++) {
  26.                 for (int j = 0; j < 80; j++) {
  27.                     g2.fillOval(x + 5 * i, x + 5 * j, 4, 4);
  28.                 }
  29.             }
  30.             g.drawImage(image, 0, 0, null);
  31.         }
  32.     };
  33.    
  34.     @Override
  35.     public void init() {
  36. //      this.setLayout(new GridLayout(1, 2));
  37.         this.add(drawPanel);
  38.         timer.start();
  39.     }
  40.  
  41.     @Override
  42.     public void actionPerformed(ActionEvent e) {
  43.         x += 1;
  44.         drawPanel.repaint();
  45.     }
  46. }
');