RSS

Scrolling Background Java

03 Mei

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.

*/

package tbdamg;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JFrame;
import javax.swing.JPanel;

/**
*
* @author hafizh
*/
public class manggilTES extends JFrame implements Runnable, KeyListener {
tes n=new tes();
int y=300,x=50,lempar=0,modulo=100,bolehJln=0,xmap=600,ymap=150;
int dx,dy=300,bg1=800,bg2=0;
Thread tr=new Thread(this);

public manggilTES(){
n.setLayout(null);
add(n);
setSize(800,600);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setVisible(true);
addKeyListener(this);
tr.start();
}

public static void main(String[] args) {
new manggilTES();
}

public void run() {

while(true){

try{
Thread.sleep(20);}
catch(Exception e){

}
dx=10;
bg1=bg1+dx;
bg2=bg2+dx;
xmap=xmap-2;
ymap=ymap+1;
lempar++;

Source code 1: https://www.dropbox.com/s/ny3wv5tetnvk6bq/tes.txt

Source code 2: https://www.dropbox.com/s/g846fueud2i5nfy/manggilTES.txt

 
Tinggalkan komentar

Ditulis oleh pada 3 Mei 2012 in Java

 

Tag: , , , , , , , , , , , , , , , , , , , , , ,

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

 
%d blogger menyukai ini: