Posts

Showing posts from July, 2013

How to use Properties File in JAVA

  How to use Properties files of JAVA in NetBeansIDE 1. Open NetBeansIDE. 2. In your project,         2.1 right click on package(any package)     2.2 choose>new>others>others>properties file 3. In properties file, write the 'key' and its 'value'    as     (key)=(value)     (key)=(value)     ..... 4. To access the properties file, make a new java class file and write your code(in video)... 5. Run the file. 6. Finish.   Thank You Click here to visit my facebook page for more videos

How to make simple Dice in JAVA using NetBeansIDE

Image
How to make simple Dice in JAVA using NetBeansIDE 1: Make a netbeans java application project. 2: Make a jFrame form with JLabel and JButton. 3: Copy the required dice images to the default package(or any other package) of the project. 4: Right click on jButton and select Events>Action>actionPerfomed in the popup menu. 5: Write the code. code for the image display on random: Random rd=new Random();         int random=0;         random=rd.nextInt(6)+1;         switch(random){             case 1:                 jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dice1.gif")));                 break;             case 2:                 jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dice2.gif")));                 break;             case 3:                 jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dice3.gif")));                 break;             case 4: