Skip to main content

List of Natural Numbers - Netbeans Java Codes


You can also download text file of this code here:  NaturalNum.txt

Java Code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
                int a = Integer.parseInt(txt1.getText());
for (int I = 1; I<=a; I++)
            txt2.setText(txt2.getText() + " " + Integer.toString(I));
    }                                        

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
           System.exit(0);
    }              
[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

Javax Code for Playing Music:

Javax Code for Playing Music: OUTPUT: ________________________________________________________________ Just Copy and Paste and Change the variable name respectively: ________________________________________________________________ ________________________________________________________________ Buttons: 1. jButton1 : Open Music File 2. jButton2 : Play 3, jButton3 : Stop 4. jButton4 : Pause ________________________________________________________________ import java.io.File;     import java.io.IOException;     import java.net. MalformedURLException;     import javax.sound.sampled. AudioInputStream;     import javax.sound.sampled. AudioSystem;     import javax.sound.sampled.Clip;     import javax.sound.sampled. LineUnavailableException;     import javax.sound.sampled. UnsupportedAudioFileException; public class Music extends javax.swing.JFrame {     /** ...