Social Icons

Cara mendapatkan bitcoin gratis

Sunday, 7 September 2014

program login mahasiswa


Source Code :

import java.io.*;
/* Contoh menggunakan class BufferedReader */
public class LoginMahasiswa
{
public static void main( String[] args ){
try {
String nNama;
String nNim;
String nKelas;
String nJurusan;
String nAlamat;
String nMotto;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Masukan Nama Anda:");
nNama = in.readLine();
System.out.print("Masukan Nim Anda:");
nNim = in.readLine();
System.out.print("Masukan Kelas Anda:");
nKelas = in.readLine();
System.out.print("Masukan Jurusan Anda:");
nJurusan = in.readLine();
System.out.print("Masukan Alamat Anda:");
nAlamat = in.readLine();
System.out.print("Masukan Motto Anda:");
nMotto = in.readLine();
System.out.println();
System.out.println(" Selamat Anda Sudah Login Sebagai Mahasiswa ");
} catch( Exception e ){
System.out.println(e);
}
}
Outputnya :
Selengkapnya...

program profil


Source Code :

import javax.swing.JOptionPane;
/* Contoh menggunakan class JOptionPane */
public class ProgramProfil1
{
public static void main( String[] args ){
String Fname = "";
String Lname = "";
Fname = JOptionPane.showInputDialog("Masukan Nama Anda");
Fname = JOptionPane.showInputDialog("Masukan Nim Anda");
Fname = JOptionPane.showInputDialog("Masukan Kelas Anda");
Fname = JOptionPane.showInputDialog("Masukan Jurusan Anda");
Fname = JOptionPane.showInputDialog("Masukan Motto Anda");
String msg = "!!! Terimakasih Anda Sudah Menjadi Member Baru " + Lname+"!!!";
JOptionPane.showMessageDialog(null, msg);
}
}


Output nya :




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

Antivirus Rontok Asmara


Halloo, apa kabar nih gann,
Mungkin lansung kita bahas ajj yy, materi ini saya share tentang bikin antivirus dengan JAVA yang mudah..
dan sekarang ini saya share AntiVirus dengan nama Antivirus Rontok Asmara,,  heheheheeh
Kemungkinan kita dengar namanya agak lebay, or bgai mna begitu,, hehe, sory gan agak lebay dikit.
Mungkin kita lansung dengan pokok pembahasan nya ajj gan,, klau gan mau bikin antivirus dengan java kemungkinan mumet gan,, soal nya coding nya banyak bangets nihh,,,

Saya sudah bikin nih Antivirus, dengan nama Antivirus Rontok Asmara dan Outputnya seperti tampilan di bawah ini gann,,  agak" lebay gitu tampilannya gann,,  heheh

Outputnya :


link nya gan,,  secara complite nih source code yang sudah jadi :
klau sudah download, jangan lupa kasi saran & kritiknya yy gan,,,
Selengkapnya...

membuat Form Login



Sekarang ini saya ingin membuat sebuah form Login untuk tugas kampus nih
gann, tapi saya ingin bikin nya sederhana ajj nih gannn,,

1. Pertama - tama sebelum melakukan apa pun gan kita wajib baca bismillah dulu gan,,  agar dapat kemudahan untuk mengerjakan sesuatu gann .

2. Saya buka software notped ++ dulu gan,,,

3. Copas coding di bawah ini gan,, ke notped ++

Source Code :

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class SimpleLogin extends JFrame implements ActionListener {
private JLabel label1, label2;
private JTextField txtUser;
private JPasswordField pwdPass;
private JButton btnLogin, btnExit;

public SimpleLogin() {
super ("Login Simpel");

Container container = getContentPane();
container.setLayout(new FlowLayout());

label1 = new JLabel ("Username : ");
label2 = new JLabel ("Password : ");

txtUser = new JTextField (20);
txtUser.setToolTipText("Input Username");
pwdPass = new JPasswordField(20);

btnLogin = new JButton ("Login");
btnLogin.addActionListener(this);
btnExit = new JButton ("Exit");
btnExit.addActionListener(this);

container.add(label1);
container.add(txtUser);
container.add(label2);
container.add(pwdPass);
container.add(btnLogin);
container.add(btnExit);

setSize (300,200);
setVisible (true);
}

public static void main (String args[]) {
SimpleLogin test = new SimpleLogin();
test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

private String user = "", pass = "";
public void actionPerformed (ActionEvent e) {
if (e.getSource() == btnLogin) {
user = txtUser.getText();
pass = pwdPass.getText();
if (user.equals("jaka") && pass.equals("amikom")) {
JOptionPane.showMessageDialog(null, "Login successfull");
} else {
JOptionPane.showMessageDialog(null, "Username and password dosn't match!");
txtUser.setText("");
pwdPass.setText("");
txtUser.requestFocus(true);
}
} else if (e.getSource() == btnExit){
JOptionPane.showMessageDialog(null,"Thanks to try my program. See you..");
System.exit(0);
}
}
}

4. Save file yang dibikin tadi dengan nama SimpleLogin.java 
5. Komfile file tadi dengan menggunakan CMD gannn,,
6. Selesai deh gannn bikin nya.
7. Untuk mau masuk Form Login tersebu, maka gan ketikkan 
    User Name dengan Nama : jaka
    Passwordnya gann dengan : amikom
semoga sukses gannn, n smoga bisa membantu gan denga source code ini,,
Outputnya :
JANGAN LUPA KOMENTARNYA Y GANNN,,   hehehehe
Selengkapnya...

membuat JSlider sederhana


Gan sekarang ini saya ingin membuat JSlider Sederhana, jangan panjang" lgi gan bahas nya dan lansung kita buka ajj notped ++ dan Copas kan coding dibawah  ini :

Souce Code :

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.event.*;



public class SimpleSliderDemo extends JFrame {

private JSlider slider;

private JTextField txtValue;



public SimpleSliderDemo() {

super ("JSlider Sederhana");



Container container = getContentPane();

container.setLayout(new FlowLayout());



txtValue = new JTextField (20);

txtValue.setBackground(Color.WHITE);

txtValue.setEditable(false);



slider = new JSlider(SwingConstants.HORIZONTAL,0,100,50);

txtValue.setText(String.valueOf(slider.getValue()));

slider.setMinorTickSpacing(5);

slider.setMajorTickSpacing(20);

slider.setPaintTicks(true);

slider.setLabelTable(slider.getLabelTable());

slider.setPaintLabels(true);



slider.addChangeListener (

new ChangeListener() {

public void stateChanged (ChangeEvent e) {

txtValue.setText ( String.valueOf(slider.getValue()) );

}

}

);



container.add(txtValue);

container.add(slider);



setSize (280,200);

setVisible (true);

}



public static void main (String args[]) {

JFrame.setDefaultLookAndFeelDecorated(true);

SimpleSliderDemo test = new SimpleSliderDemo();

test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

}

maka outputnya seperti ini gan :
jangan lupa komentarnya ya gannn,,,,,,,
Salam Sukses gannn,,,,
Selengkapnya...

Bikin Aplikasi Chating

Sekarang ini saya ingin bikin sebuah aplikasi chatt nih gan menggunakan aplikasi java,,  biar saya lebih mudah dapat chatt an ama doii saya gann,,,  heehehehe

Langkah - langkah nya gannn,,,

1. Buka aplikasi notped ++
2. Copas Source Code dibawah ini gan

Source Code :

import java.net.*;
import java.io.*;
public class Server1 {
public static void main(String[] args) {
try {
ServerSocket ss = new ServerSocket(2002);
System.out.println("Menunggu Klien...");
Socket s = ss.accept();
System.out.println("Klien telah masuk");
System.out.println("Server pada port = "+
s.getLocalAddress().getHostAddress() + " : " + s.getLocalPort());
System.out.println("Client pada port = "+
s.getInetAddress().getHostAddress() + " : " + s.getPort());
PrintWriter pw = new PrintWriter(s.getOutputStream(), true);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String greeting = "";
while(!(greeting=br.readLine()).equals("")) { pw.println(greeting); }
pw.close(); s.close(); ss.close();
} catch (Exception e) { e.printStackTrace(); }
}
}

3. Lalu save file yang di bikin tadi itu gan,,  dengan nama  Server1.java
4. Selanjutnya kita bikin Client Servernya gann,, dan buka notped ++ lgi gan,,
5. Copas coding di bawah ini ke notped ++ gann,,,

Source code :

import java.net.*;
import java.io.*;
public class Client1 {
public static void main(String[] args) {
try {
Socket s = new Socket("127.0.0.1",2002);
System.out.println("Komunikasi terhubung");
System.out.println("Client pada port = "+
s.getLocalAddress().getHostAddress() + " : "+ s.getLocalPort());
System.out.println("Server pada port = "+
s.getInetAddress().getHostAddress() + " : "+ s.getPort());
BufferedReader br = new BufferedReader( new InputStreamReader(s.getInputStream()));
System.out.println("Menunggu pesan...");
String greeting = "";
while ((greeting=br.readLine())!=null) { System.out.println(greeting); }
System.out.println("Selesai");
br.close();
s.close();
}
catch (Exception e) { e.printStackTrace(); }
}
}

6. Lalu save file yang di bikin tadi itu gan,,  dengan nama  Client1.java
7. Komfile aplikasi yang gan bikin tadi dengan CMD,, ingatt gann,,  Komfile nya secara bersamaan dengan Server1 bersama Client1.
Maka Hasilnya seperti di bawah ini gannn,,,


ehmmmm,,,  jangan lupa komentar dan sarannya yaa gannn,,,  hehehe
Selengkapnya...

web Broswer


Hayyy gan,, apa kabarnya,,,
Hari ini saya ingin menshare sebuah aplikasi WebBrowcser nih gann,,, kemungkinan kita sekarang ini sering browser itu dengan mbag goggle,,,  tpi sekarang ini kita browser agak lebih gaul gitu gann,,,  soal nya kita gunakan adalah dengan Java gannn,,,  hehehehe
lansung ajj ke inti nya gannn,,,

ini Outputnya gann :


ini link source code web browser nya gann :
jangan lupa komentarnya ya gannn,,,
Salam sukses gannn
Selengkapnya...

Game Tetris

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
Selengkapnya...

Game 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
Selengkapnya...

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
Selengkapnya...

jago Photoshop