Skip to main content

Posts

Showing posts from December, 2017

HOW TO MAKE AN ANIMATION IN JAVA

TODAY I WILL BE SHOWING YOU HOW TO MAKE AN ANIMATION USING JAVA.




import javax.swing.*;import java.awt.*;
 final public class Test1 {
    JFrame frame;    DrawPanel drawPanel;
    private int A = 9;    private int B = 5;
    boolean Up = false;    boolean Down = true;    public static void main(String[] args) {        new Test1().go();    }    private DrawPanel DrawPanel;
    private void go() {        frame = new JFrame("SHAPE ANIMATION");        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        DrawPanel = new DrawPanel();
        frame.getContentPane().add(BorderLayout.CENTER, DrawPanel);
        frame.setVisible(true);          frame.setResizable(false);        frame.setSize(200, 200);        frame.setLocation(175, 55);b        moveANIME();    }
    class DrawPanel extends JPanel {        public void paintComponent(Graphics g) {g.setColor(Color.BLUE.darker());              g.fillRect(0, 0, this.getWidth(), this.getHeight());            g.setColor(Color.blue.darker());  …