Skip to main content

Scrambld - Netbeans Java Codes


You can also download text file of this code here:  Scrambld.txt
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

Popular posts from this blog

Captcha - Netbeans Java Codes

You can also download text file of this code here:   Captcha.txt Java Code: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // [Find More Java Codes at www.sumikuma.tk] if ("Cleven Eleven".equals(txt1.getText())) JOptionPane.showMessageDialog(this,"You answer is correct"); else JOptionPane.showMessageDialog(null, "You are unsuccessful, Please Try Again"); } How To Display Image? : jLabel1>Properties>Icon>(Under External Image) Import to Image>Select Suitable Image from File Chooser>Select Target Folder>Click Ok> Close the Properties Window. [Find More Java Codes at www.sumikuma.tk]

Get Pascal's Triangle - Netbeans Java Codes

Run-Shot of Pascal's Triangle Java Code: public class Pascalstriangle { public static void main(String args[]) { int x = 6; int triangle[][] = new int[x][x]; for (int i = 0; i < x; i++) { for (int j = 0; j < x; j++) { triangle[i][j] = 0; } } for(int i = 0; i < x; i++) { triangle[i][0] = 1 ; } for (int i = 1; i < x; i++) { for (int j = 1; j < x; j++) { triangle[i][j] = triangle[i-1][j-1] + triangle[i-1][j]; } } for (int i = 0; i < x; i++) { for(int j=0;j<=i;j++) { System.out.print(triangle[i][j]+ " "); } System.out.println(); } } } [Find more Netbeans Java Code at www.sumikuma.tk] You can also download text file version of this code: Pascal-triangle_javacode.txt

Find Factorial -Netbeans Java Code

Run Shot of An Integer to Calculate its factorial Java Code: import java.util.Scanner; public class Factorial { public static void main(String args[]) { int n, c, fact = 1; System.out.println("Enter an integer to calculate it's factorial"); Scanner in = new Scanner(System.in); n = in.nextInt(); if ( n < 0 ) System.out.println("Number should be non-negative."); else { for ( c = 1 ; c <= n ; c++ ) fact = fact*c; System.out.println("Factorial of "+n+" is = "+fact); } } } Find more netbeans java code from www.sumikuma.tk You can also download text file version of this code: Factorial.txt