import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.WindowStateListener;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
public class Main extends JFrame implements Runnable
{
int x=40;
int y=30;
int |y<=25)
yAdd=!yAdd;
if(xAdd)
x+=30;
else
x-=30;
if(x>=this.getWidth()-width||x<=5)
xAdd=!xAdd;
repaint();
try
{
Thread.sleep(40);
i++;
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
public static void main(String[] args)
{
// Main main=new Main();
//
// main.setVisible(true);
// main.run();
Main main=new Main();
main.setVisible(true);
main.setBounds(50, 50, 800, 600);
Thread thread=new Thread(main);
thread.start();
try
{
Image image=ImageIO.read(new File(Main.class.getResource("").toString()));
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}