EYLÜL_PC_SHOP
Would you like to react to this message? Create an account in a few clicks or log in to continue.

EYLÜL_PC_SHOP

EYLÜL_PC_SHOP
 
AnasayfaAnasayfa  Latest imagesLatest images  AramaArama  Kayıt OlKayıt Ol  Giriş yapGiriş yap  

 

 hafıza oyunu

Aşağa gitmek 
YazarMesaj
Admin
Admin



Mesaj Sayısı : 99
Kayıt tarihi : 29/12/08

hafıza oyunu Empty
MesajKonu: hafıza oyunu   hafıza oyunu EmptyPerş. Ocak 01, 2009 8:51 pm

import java.awt.*;



import java.awt.event.*;



import javax.swing.*;



import java.util.*;




public class GridLayoutDemo extends JFrame implements ActionListener {


private JButton buttons[];

private String names[] = new String [16];



private boolean toggle = true;

private Container container;

private GridLayout grid1, grid2;



public GridLayoutDemo()

{


super( "Omer Memory Game 6.66" );

Random generate = new Random();

int x;



grid1 = new GridLayout(4, 4, 2, 2);

grid2 = new GridLayout(4, 4, 2, 2);






container = getContentPane();

container.setLayout(grid1);





buttons = new JButton[16];


for ( int count = 0; count < 16; count++ ) {

x = generate.nextInt(9);

buttons[ count ] = new JButton("" + x);

buttons[ count ].addActionListener( this );

container.add( buttons[ count ] );

}



setSize( 300, 300 );

setVisible( true );


}



public void actionPerformed( ActionEvent event )

{

if ( toggle )

container.setLayout( grid2 );

else



container.setLayout( grid1 );


toggle = !toggle;



container.validate();

}



public class GridGame {


public static void main(String[] args) {

GridLayoutDemo application = new GridLayoutDemo();

application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );


}
Sayfa başına dön Aşağa gitmek
http://fetle.yetkinforum.com
 
hafıza oyunu
Sayfa başına dön 
1 sayfadaki 1 sayfası
 Similar topics
-
» Protected Mode Hafıza Sistemi

Bu forumun müsaadesi var:Bu forumdaki mesajlara cevap veremezsiniz
EYLÜL_PC_SHOP :: Programlama :: Java-
Buraya geçin: