Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JFrame;
- import java.awt.*;
- public class Simple extends JFrame
- {
- public int why=50;
- public int ex=50;
- public Simple()
- {
- //Set JFrame title
- super("HOOWAH");
- //Set default close operation for JFrame
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- //Set JFrame size
- setSize(1024,800);
- //Make JFrame visible
- setVisible(true);
- }
- public void paint(Graphics g)
- {
- super.paint(g);
- g.drawString("TEXTXTXTTXT", 512, 100);
- setBackground(Color.BLACK);
- g.setColor(Color.RED);
- System.out.println("lol");
- //Draw a filled rectangle(x,y,width,height)
- g.fillRect(ex,why,100,10);
- }
- public void run(){
- boolean Stop = false;
- while (Stop==false){
- ex+= 1;
- why+= 1;
- repaint();
- try{
- Thread.sleep(10);
- }catch(Exception Ex){}
- if(ex>500){Stop=true;}
- }
- }
- public static void main(String[]args)
- {
- Simple RunSimple=new Simple();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement