Java Code:
public class ScrambleWords extends javax.swing.JFrame { public ScrambleWords() { initComponents(); check.setVisible(false); } int count=0; String st =""; private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) { count++; if(count<=8){ st=st+jLabel1.getText(); ans.setText(st);; } if(count>=8) check.setVisible(true); private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) { count++; if(count<=8){ st=st+jLabel2.getText(); ans.setText(st);; } if(count>=8) check.setVisible(true); } private void jLabel10MouseClicked(java.awt.event.MouseEvent evt) { count++; if(count<=8){ st=st+jLabel10.getText(); ans.setText(st);; } if(count>=8) check.setVisible(true); } private void jLabel6MouseClicked(java.awt.event.MouseEvent evt) { count++; if(count<=8){ st=st+jLabel6.getText(); ans.setText(st);; } if(count>=8) check.setVisible(true); } private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) { count++; if(count<=8){ st=st+jLabel3.getText(); ans.setText(st);; } if(count>=8) check.setVisible(true); } private void jLabel7MouseClicked(java.awt.event.MouseEvent evt) { count++; if(count<=8){ st=st+jLabel7.getText(); ans.setText(st);; } if(count>=8) check.setVisible(true); } private void jLabel9MouseClicked(java.awt.event.MouseEvent evt) { count++; if(count<=8){ st=st+jLabel9.getText(); ans.setText(st);; } if(count>=8) check.setVisible(true); } private void jLabel8MouseClicked(java.awt.event.MouseEvent evt) { count++; if(count<=8){ st=st+jLabel8.getText(); ans.setText(st);; } if(count>=8) check.setVisible(true); } private void checkActionPerformed(java.awt.event.ActionEvent evt) { if(ans.getText().equalsIgnoreCase("Computer")) JOptionPane.showMessageDialog(this, "Yepii!!, You Won"); else JOptionPane.showMessageDialog(this, "Wrong, Try Again"); } private void resetActionPerformed(java.awt.event.ActionEvent evt) { count =0; st =""; ans.setText(""); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new ScrambleWords().setVisible(true); } }); } [Find More Java Codes at www.sumikuma.tk]
Comments
Post a Comment