import javax.swing.*; import java.util.Vector; import java.awt.*; public class jattack extends JFrame implements Runnable{ public static Vector blockVector = new Vector(); public Thread t; public void run(){ // Målar om skärmen var 10:e ms while (true){ this.repaint(); try { // Behövs t.sleep(5); }catch (InterruptedException e){} } } public jattack(){ t=new Thread(this); t.start(); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(400,200); this.setVisible(true); } public void paint(Graphics g){ // g.setColor(Color.white); // g.fillRect(10,10,this.getWidth(),this.getHeight()); for (int i=0;imax){ ydir = -1; } if (y<0){ ydir = 1; } y+=ydir; } }