1. game kla klouk in java




↬ This is a simple game that is created by using java language, jFrame in netBean.
↬ This is the source to random:
//random images
     int index,index1,index2; 
    private String[] images ={"img/Tiger.png","img/Klouk.png","img/Chicken.png","img/Lobster.png","img/Crab.png","img/Fish.png"};
        Random rand = rand = new Random();
          Timer timer = new Timer(10, new ActionListener(){
          @Override
           public void actionPerformed(ActionEvent e) {
                 index = rand.nextInt(6);
                 index1 = rand.nextInt(6);
                 index2 = rand.nextInt(6);
                 Image im=new ImageIcon(this.getClass()
                 .getResource(images[index])).getImage();
                 Image im1=new ImageIcon(this.getClass()
                 .getResource(images[index1])).getImage();
                 Image im2=new ImageIcon(this.getClass()
                 .getResource(images[index2])).getImage();
                 ImageIcon iconLogo = new ImageIcon(im);
                 ImageIcon iconLogo1 = new ImageIcon(im1);
                 ImageIcon iconLogo2 = new ImageIcon(im2);
                 RA.setIcon(iconLogo);
                 RB.setIcon(iconLogo1);
                 RC.setIcon(iconLogo2);
           }
        });    
//end random images


Download]

0 comments:

Post a Comment

ads

Powered by Blogger.