Skip to main content

Display Even-Odd Numbers Series - Netbeans Java Project


You can also download text file of this code here:  Even-Odd.txt

Java Code:

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // [Find More Java Codes at www.sumikuma.tk]
        int LastNumber = Integer.parseInt(jTextField1.getText());
        if (jRadioButton1.isSelected())
        { for (int I = 2; I<=LastNumber; I+=2)
                jTextArea1.setText(jTextArea1.getText()+" " +Integer.toString(I));
        }
        else if (jRadioButton2.isSelected())
        {
            for (int I = 1; I<=LastNumber; I+=2)
                jTextArea1.setText(jTextArea1.getText()+" " + Integer.toString(I));
                   }
        else JOptionPane.showMessageDialog(this, "Click to select [Even] or [Odd] Option");
    }                                        

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // [Find More Java Codes at www.sumikuma.tk]
        jTextField1.setText("");
        jRadioButton1.setSelected(false);
        jRadioButton2.setSelected(false);
        jTextArea1.setText("");
    }                                        

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // [Find More Java Codes at www.sumikuma.tk]
        System.exit(0);     
    }

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]

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

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++; i...