Membuat Game Tebak Kata di Java 100% work

Tutorial membuat game tebak kata sederhana

Cara kerja game tebak kata

kita membuat sebuah logika ke dalam sebuah script java yang kita buat , hasilnya ketika kita menebak dengan memasukan sebuah huruf yang dimana sebuah kata akan di munculkan secara random. pengertian game tebak kata adalah membuat game dengan memasukan sebuah kata atau apapun secara random menggunakan logika mausia.

Penjelasan game quiz tebak kata

Membuat game dengan menggunakan Java mungkin terlihat susah pada awalnya, tetapi ketika Anda mendapatkan memahamkan dasar-dasar, Anda akan menyadari bahwa itu adalah bahasa pemrograman yang dirancang untuk membuat segalanya lebih mudah bagi pembuat.Sebelum, game diciptakan baik melalui C atau C ++. Namun, itu berubah ketika gadget mobile mengambil alih sebagai platform yang paling populer untuk bermain game. Banyak permainan untuk Android dan platform iOS saat ini sedang dikembangkan menggunakan Java. Judul memenangkan penghargaan seperti Angry Birds. Perangkat lunak pertama yang menawarkan hiburan kasino online kembali pada tahun 1996, InterCasino, telah melompat pada kereta musik dalam menggunakan Java untuk mengembangkan permainan mesin slot. Salah satu MMORPG populer saat ini, Runescape, juga produk dari pemrograman Java.

Dengan dasar-dasar ini, Anda akan dapat mengatur diri dalam arah yang benar untuk mengembangkan game menggunakan Java. disini saya akan share cara membuat game di pemograman  java menggunakan eclipse.bagi anda yang ingin mencoba game sederhana di java  tapi tidak tahu harus bagai mana ?? jangan kuatir karena saya akan menjelaskan di post sekarang.

Tahapan membuat game tebak kata sederhana

Tahapan pertama  download dulu file tambahan ini :

1. Download folder game kata
2. Download Database Game Kata dan import ke phpmyadmin anda
3. buat folder src dan masukan ke dalam folder game kata ingat kasih nama foldernya (GameKata)
4. kemudian masukan script ” yang di blog ke dalam folder src

Tahapan ke-2  masukan script di bawah ini :

  1. Anda harus membuat package form
  2. membuat 5 Class di dalam package form yaitu : home.java , soal0.java ,soal1.java,soal2.java dan soal3.java
Tahapan ke-3  masukan script class-class berikut kedalam home.java , soal0.java ,soal1.java,soal2.java dan soal3.java.
 
home.java
 
package form;
 
//import code.buildWords;
 
import java.util.Random;
import javax.swing.JOptionPane;
 
 
//import java.awt.event.KeyEvent;
//import java.awt.*;
//import java.awt.event.*;
//import javax.swing.*;
//import javax.swing.JLabel;
//import javax.swing.JTextField;
 
public class home extends javax.swing.JFrame {
 
    /**
     * Creates new
form home
     */
    public home() {
initComponents();
    }
 
//    private
JTextField text;
//    private JLabel
label;
 
    /**
     * This method is
called from within the constructor to initialize the form.
     * WARNING: Do NOT
modify this code. The content of this method is always
     * regenerated by
the Form Editor.
     */
@SuppressWarnings(“unchecked”)
    // <editor-fold
defaultstate=”collapsed” desc=”Generated Code”>
    private void
initComponents() {
 
        jButton1 = new
javax.swing.JButton();
        jButton2 = new
javax.swing.JButton();
        jButton3 = new
javax.swing.JButton();
 
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setPreferredSize(new java.awt.Dimension(400, 300));
addWindowListener(new java.awt.event.WindowAdapter() {
            public
void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
            }
        });
addKeyListener(new java.awt.event.KeyAdapter() {
            public
void keyPressed(java.awt.event.KeyEvent evt) {
formKeyPressed(evt);
            }
        });
 
jButton1.setText(“Mulai”);
jButton1.addActionListener(new java.awt.event.ActionListener() {
            public
void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
            }
        });
 
jButton2.setText(“Bantuan”);
jButton2.addActionListener(new java.awt.event.ActionListener() {
            public
void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
            }
        });
 
jButton3.setText(“Nilai Tertinggi”);
jButton3.addActionListener(new java.awt.event.ActionListener() {
            public
void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
            }
        });
 
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(140, 140, 140)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jButton1)
.addComponent(jButton2)
.addComponent(jButton3))
.addContainerGap(163, Short.MAX_VALUE))
        );
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(85, 85, 85)
.addComponent(jButton1)
.addGap(18, 18, 18)
.addComponent(jButton2)
.addGap(18, 18, 18)
.addComponent(jButton3)
.addContainerGap(110, Short.MAX_VALUE))
        );
 
        pack();
    }//
</editor-fold>
 
    private void
formKeyPressed(java.awt.event.KeyEvent evt) {
        // TODO add
your handling code here:
        String s =
Character.toString(evt.getKeyChar());
    }
 
    private void
formWindowOpened(java.awt.event.WindowEvent evt) {
        // TODO add your handling code here:
jButton3.setVisible(false);
    }
 
    private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add
your handling code here:
        Random r = new
Random();
        int a =
r.nextInt(3);
 
        switch(a) {
            case 0 :
                new
soal0().setVisible(true);
//this.setVisible(false);
                break;
            case 1 :
                new
soal1().setVisible(true);
//this.setVisible(false);
                break;
            case 2 :
                new
soal2().setVisible(true);
//this.setVisible(false);
                break;
            case 3 :
                new
soal3().setVisible(true);
//this.setVisible(false);
                break;
        }
    }
 
    private void
jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add
your handling code here:
    }
 
    private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add
your handling code here:
JOptionPane.showMessageDialog(null,”                  SELAMAT DATANGn”+
                                           “Tekan tombol
Mulai untuk memulai permainann”+
“Baca petunjuk untuk menebak huruf dari kata yang
ditanyakann”+
” pembuat: https://infodani.net/ “);
    }
 
    /**
     * @param args the
command line arguments
     */
    public static void
main(String args[]) {
        /* Set the
Nimbus look and feel */
//<editor-fold defaultstate=”collapsed” desc=” Look
and feel setting code (optional) “>
        /* If Nimbus
(introduced in Java SE 6) is not available, stay with the default look and
feel.
         * For details
see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for
(javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
                if
(“Nimbus”.equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
                }
            }
        } catch
(ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(home.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
        } catch
(InstantiationException ex) {
java.util.logging.Logger.getLogger(home.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
        } catch
(IllegalAccessException ex) {
java.util.logging.Logger.getLogger(home.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
        } catch
(javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(home.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
        }
//</editor-fold>
 
        /* Create and
display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
            public
void run() {
                new
home().setVisible(true);
            }
        });
    }
 
    // Variables
declaration – do not modify
    private
javax.swing.JButton jButton1;
    private
javax.swing.JButton jButton2;
    private
javax.swing.JButton jButton3;
    // End of
variables declaration
}
soal0.java
 
 
package form;
 
import code.connection;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
 
/**
 *
 * @author Administrator
 */
public class soal0 extends javax.swing.JFrame {
 
    /**
     * Creates new form soal0
     */
    public soal0() {
        initComponents();
    }
 
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings(“unchecked”)
    // <editor-fold defaultstate=”collapsed” desc=”Generated Code”>
    private void initComponents() {
 
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
 
        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });
        addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                formKeyPressed(evt);
            }
        });
 
        jLabel1.setFont(new java.awt.Font(“Tahoma”, 0, 14)); // NOI18N
        jLabel1.setText(“Loading Content . . .”);
 
        jLabel2.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel2.setText(“_”);
 
        jLabel3.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel3.setText(“_”);
 
        jLabel4.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel4.setText(“_”);
 
        jLabel5.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel5.setText(“_”);
 
        jLabel6.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel6.setText(“_”);
 
        jLabel7.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel7.setText(“_”);
 
        jLabel8.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel8.setText(“_”);
 
        jLabel9.setText(“Tekan huruf pada keyboard anda untuk menjawab”);
 
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel8))
                    .addComponent(jLabel9))
                .addContainerGap(148, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jLabel7)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 200, Short.MAX_VALUE)
                .addComponent(jLabel9)
                .addContainerGap())
        );
 
        pack();
    }// </editor-fold>
 
    private void formWindowOpened(java.awt.event.WindowEvent evt) {
        // TODO add your handling code here:
        connection c = new connection();
        ResultSet r;
        try {
            r = c.viewData(“SELECT * FROM soal WHERE id = 1”);
            while(r.next()) {
                jLabel1.setText(r.getString(“soal”));
            }
        } catch(Exception e) {
 
        }
    }
 
    private void formKeyPressed(java.awt.event.KeyEvent evt) {
        // TODO add your handling code here:
        String s = Character.toString(evt.getKeyChar());
        connection c = new connection();
        ResultSet r;
        String[] j;
        try {
            r = c.viewData(“SELECT * FROM soal WHERE id = 1”);
            while(r.next()) {
                j = r.getString(“jawaban”).split(“”);
                if(s.equals(j[0])) {
                    jLabel2.setText(s.toUpperCase());
                    jLabel5.setText(s.toUpperCase());
                    jLabel7.setText(s.toUpperCase());
                }
                if(s.equals(j[1])) {
                    jLabel3.setText(s.toUpperCase());
                }
                if(s.equals(j[2])) {
                    jLabel4.setText(s.toUpperCase());
                }
                if(s.equals(j[4])) {
                    jLabel6.setText(s.toUpperCase());
                }
                if(s.equals(j[6])) {
                    jLabel8.setText(s.toUpperCase());
                }
            }
        } catch(Exception e) {
 
        }
        if(!jLabel2.getText().equals(“_”) && !jLabel3.getText().equals(“_”) && !jLabel4.getText().equals(“_”) && !jLabel5.getText().equals(“_”) && !jLabel6.getText().equals(“_”) && !jLabel7.getText().equals(“_”) && !jLabel8.getText().equals(“_”)) {
            JOptionPane.showMessageDialog(null,”Selamat Anda Berhasil Menjawab”);
        }
    }
 
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate=”collapsed” desc=” Look and feel setting code (optional) “>
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if (“Nimbus”.equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(soal0.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(soal0.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(soal0.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(soal0.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
 
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new soal0().setVisible(true);
            }
        });
    }
 
    // Variables declaration – do not modify
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    // End of variables declaration
}
 
soal1.java
 
package form;
 
import code.connection;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
 
/**
 *
 * @author Administrator
 */
public class soal1 extends javax.swing.JFrame {
 
    /**
     * Creates new form soal1
     */
    public soal1() {
        initComponents();
    }
 
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings(“unchecked”)
    // <editor-fold defaultstate=”collapsed” desc=”Generated Code”>
    private void initComponents() {
 
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
 
        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });
        addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                formKeyPressed(evt);
            }
        });
 
        jLabel1.setFont(new java.awt.Font(“Tahoma”, 0, 14)); // NOI18N
        jLabel1.setText(“Loading Content . . .”);
 
        jLabel2.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel2.setText(“_”);
 
        jLabel3.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel3.setText(“_”);
 
        jLabel4.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel4.setText(“_”);
 
        jLabel5.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel5.setText(“_”);
 
        jLabel6.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel6.setText(“_”);
 
        jLabel7.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel7.setText(“_”);
 
        jLabel8.setText(“Tekan huruf pada keyboard anda untuk menjawab”);
 
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel7))
                    .addComponent(jLabel8))
                .addContainerGap(148, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 200, Short.MAX_VALUE)
                .addComponent(jLabel8)
                .addContainerGap())
        );
 
        pack();
    }// </editor-fold>
 
    private void formWindowOpened(java.awt.event.WindowEvent evt) {
        // TODO add your handling code here:
        connection c = new connection();
        ResultSet r;
        try {
            r = c.viewData(“SELECT * FROM soal WHERE id = 2”);
            while(r.next()) {
                jLabel1.setText(r.getString(“soal”));
            }
        } catch(Exception e) {
 
        }
    }
 
    private void formKeyPressed(java.awt.event.KeyEvent evt) {
        // TODO add your handling code here:
        String s = Character.toString(evt.getKeyChar());
        connection c = new connection();
        ResultSet r;
        String[] j;
        try {
            r = c.viewData(“SELECT * FROM soal WHERE id = 2”);
            while(r.next()) {
                j = r.getString(“jawaban”).split(“”);
                if(s.equals(j[0])) {
                    jLabel2.setText(s.toUpperCase());
                }
                if(s.equals(j[1])) {
                    jLabel3.setText(s.toUpperCase());
                }
                if(s.equals(j[2])) {
                    jLabel4.setText(s.toUpperCase());
                }
                if(s.equals(j[3])) {
                    jLabel5.setText(s.toUpperCase());
                    jLabel7.setText(s.toUpperCase());
                }
                if(s.equals(j[4])) {
                    jLabel6.setText(s.toUpperCase());
                }
            }
        } catch(Exception e) {
 
        }
        if(!jLabel2.getText().equals(“_”) && !jLabel3.getText().equals(“_”) && !jLabel4.getText().equals(“_”) && !jLabel5.getText().equals(“_”) && !jLabel6.getText().equals(“_”) && !jLabel7.getText().equals(“_”)) {
            JOptionPane.showMessageDialog(null,”Selamat Anda Berhasil Menjawab”);
        }
    }
 
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate=”collapsed” desc=” Look and feel setting code (optional) “>
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if (“Nimbus”.equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(soal1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(soal1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(soal1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(soal1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
 
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new soal1().setVisible(true);
            }
        });
    }
 
    // Variables declaration – do not modify
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    // End of variables declaration
}
 
 
 
soal2.java
 
package form;
 
import code.connection;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
 
/**
 *
 * @author Administrator
 */
public class soal2 extends javax.swing.JFrame {
 
    /**
     * Creates new form soal2
     */
    public soal2() {
        initComponents();
    }
 
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings(“unchecked”)
    // <editor-fold defaultstate=”collapsed” desc=”Generated Code”>
    private void initComponents() {
 
        jLabel9 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
 
        jLabel9.setText(“Tekan huruf pada keyboard anda untuk menjawab”);
 
        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });
        addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                formKeyPressed(evt);
            }
        });
 
        jLabel1.setFont(new java.awt.Font(“Tahoma”, 0, 14)); // NOI18N
        jLabel1.setText(“Loading Content . . .”);
 
        jLabel2.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel2.setText(“_”);
 
        jLabel3.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel3.setText(“_”);
 
        jLabel4.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel4.setText(“_”);
 
        jLabel5.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel5.setText(“_”);
 
        jLabel6.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel6.setText(“_”);
 
        jLabel7.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel7.setText(“_”);
 
        jLabel8.setText(“Tekan huruf pada keyboard anda untuk menjawab”);
 
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel7))
                    .addComponent(jLabel8))
                .addContainerGap(148, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 200, Short.MAX_VALUE)
                .addComponent(jLabel8)
                .addContainerGap())
        );
 
        pack();
    }// </editor-fold>
 
    private void formKeyPressed(java.awt.event.KeyEvent evt) {
        // TODO add your handling code here:
        String s = Character.toString(evt.getKeyChar());
        connection c = new connection();
        ResultSet r;
        String[] j;
        try {
            r = c.viewData(“SELECT * FROM soal WHERE id = 3”);
            while(r.next()) {
                j = r.getString(“jawaban”).split(“”);
                if(s.equals(j[0])) {
                    jLabel2.setText(s.toUpperCase());
                }
                if(s.equals(j[1])) {
                    jLabel3.setText(s.toUpperCase());
                }
                if(s.equals(j[2])) {
                    jLabel4.setText(s.toUpperCase());
                }
                if(s.equals(j[3])) {
                    jLabel5.setText(s.toUpperCase());
                }
                if(s.equals(j[4])) {
                    jLabel6.setText(s.toUpperCase());
                }
                if(s.equals(j[5])) {
                    jLabel7.setText(s.toUpperCase());
                }
            }
        } catch(Exception e) {
 
        }
        if(!jLabel2.getText().equals(“_”) && !jLabel3.getText().equals(“_”) && !jLabel4.getText().equals(“_”) && !jLabel5.getText().equals(“_”) && !jLabel6.getText().equals(“_”) && !jLabel7.getText().equals(“_”)) {
            JOptionPane.showMessageDialog(null,”Selamat Anda Berhasil Menjawab”);
        }
    }
 
    private void formWindowOpened(java.awt.event.WindowEvent evt) {
        // TODO add your handling code here:
        connection c = new connection();
        ResultSet r;
        try {
            r = c.viewData(“SELECT * FROM soal WHERE id = 3”);
            while(r.next()) {
                jLabel1.setText(r.getString(“soal”));
            }
        } catch(Exception e) {
 
        }
    }
 
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate=”collapsed” desc=” Look and feel setting code (optional) “>
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if (“Nimbus”.equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(soal2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(soal2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(soal2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(soal2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
 
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new soal2().setVisible(true);
            }
        });
    }
 
    // Variables declaration – do not modify
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    // End of variables declaration
}
 
 
 
soal3.java
package form;
 
import code.connection;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
 
/**
 *
 * @author Administrator
 */
public class soal3 extends javax.swing.JFrame {
 
    /**
     * Creates new form soal3
     */
    public soal3() {
        initComponents();
    }
 
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings(“unchecked”)
    // <editor-fold defaultstate=”collapsed” desc=”Generated Code”>
    private void initComponents() {
 
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
 
        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        addKeyListener(new java.awt.event.KeyAdapter() {

 
            public void keyPressed(java.awt.event.KeyEvent evt) {
                formKeyPressed(evt);
            }
        });
 
        jLabel1.setFont(new java.awt.Font(“Tahoma”, 0, 14)); // NOI18N
        jLabel1.setText(“Loading Content . . .”);
 
        jLabel2.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel2.setText(“_”);
 
        jLabel3.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel3.setText(“_”);
 
        jLabel4.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel4.setText(“_”);
 
        jLabel5.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel5.setText(“_”);
 
        jLabel6.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel6.setText(“_”);
 
        jLabel7.setFont(new java.awt.Font(“Tahoma”, 0, 24)); // NOI18N
        jLabel7.setText(“_”);
 
        jLabel8.setText(“Tekan huruf pada keyboard anda untuk menjawab”);
 
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel6)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel7))
                    .addComponent(jLabel8))
                .addContainerGap(148, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 200, Short.MAX_VALUE)
                .addComponent(jLabel8)
                .addContainerGap())
        );
 
        pack();
    }// </editor-fold>
 
    private void formKeyPressed(java.awt.event.KeyEvent evt) {
        // TODO add your handling code here:
        String s = Character.toString(evt.getKeyChar());
        connection c = new connection();
        ResultSet r;
        String[] j;
        try {
            r = c.viewData(“SELECT * FROM soal WHERE id = 4”);
            while(r.next()) {
                j = r.getString(“jawaban”).split(“”);
                if(s.equals(j[0])) {
                    jLabel2.setText(s.toUpperCase());
                }
                if(s.equals(j[1])) {
                    jLabel3.setText(s.toUpperCase());
                }
                if(s.equals(j[2])) {
                    jLabel4.setText(s.toUpperCase());
                }
                if(s.equals(j[3])) {
                    jLabel5.setText(s.toUpperCase());
                    jLabel7.setText(s.toUpperCase());
                }
                if(s.equals(j[4])) {
                    jLabel6.setText(s.toUpperCase());
                }
            }
        } catch(Exception e) {
 
        }
        if(!jLabel2.getText().equals(“_”) && !jLabel3.getText().equals(“_”) && !jLabel4.getText().equals(“_”) && !jLabel5.getText().equals(“_”) && !jLabel6.getText().equals(“_”) && !jLabel7.getText().equals(“_”)) {
            JOptionPane.showMessageDialog(null,”Selamat Anda Berhasil Menjawab”);
        }
    }
 
    private void formWindowOpened(java.awt.event.WindowEvent evt) {
        // TODO add your handling code here:
        connection c = new connection();
        ResultSet r;
        try {
            r = c.viewData(“SELECT * FROM soal WHERE id = 4”);
            while(r.next()) {
                jLabel1.setText(r.getString(“soal”));
            }
        } catch(Exception e) {
 
        }
    }
 
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate=”collapsed” desc=” Look and feel setting code (optional) “>
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if (“Nimbus”.equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(soal3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(soal3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(soal3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(soal3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
 
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new soal3().setVisible(true);
            }
        });
    }
    // Variables declaration – do not modify
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    // End of variables declaration
}
 
 
 
 

Hasil output Progra

Membuat Game Tebak Kata di Java 100% work
Menebak kata
 
 
Membuat Game Tebak Kata di Java 100% work
 
 
 
 
INFO BARU :  kata penunjuk dekat dan jauh bahasa korea

Check Also

TEST TOEFL ITP Level 1 and 2 ,jawaban dan Pembahasan

TEST TOEFL ITP Level 1 and 2 ,jawaban dan Pembahasan

  TOEFL ITP (Institutional Testing Program) adalah versi tes TOEFL yang digunakan oleh lembaga pendidikan …

CARA DOWNLOAD BANYAK VIDEO FACEBOOK

Download banyak video facebook komputer dan android

Aplikasi download video facebook di komputer dan android Video Downloader for Facebook by InShot. MyVideoDownloader …

Cara Hack Facebook Orang Lain Terbaru 2020

Hack Facebook Orang dan cara melindunginya 100% jalan

Cara Hack Facebook Orang Lain Terbaru 2020 informasi pribadi berharga di Facebook bisa di temukan siapa saja …

3 comments

  1. Gk ada video tutorialnya gitu gan?
    Biar mudah ngertinya

  2. untuk saat ini belum gan, belum ada waktu hhe
    tapi ikutin blog di atas juga pasti berhasil ko.asal teliti ikutin instruksi nya .

Leave a Reply

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!! TOLONG MATIKAN BLOCK IKLAN UNTUK MELIHAT WEB INI

Kami mendeteksi bahwa Anda menggunakan ekstensi untuk memblokir iklan. Tolong dukung kami dengan menonaktifkan pemblokir iklan ini.