SlideShare a Scribd company logo
1 of 8
Download to read offline
THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE |
Advanced Programming Lab Notes
Matching Game In Java
1 RESOURCES
• Package java.awt (Container, GridLayout, event package)
o http://docs.oracle.com/javase/8/docs/api/java/awt/package-frame.html
• Package javax.swing (window components and also Timer class)
o http://docs.oracle.com/javase/8/docs/api/javax/swing/package-frame.html
• Package java.util (Vector, Random)
o https://docs.oracle.com/javase/tutorial/essential/concurrency/runthread.html
2 LAB SESSION
2.1 CREATE A NEW PROJECT
• Select File->New->Java Project
• “Under Create a Java Project”
dialog box, for the Project Name
field, type in matchingGame as
project name
2.2 CREATE A CARD CLASS
• Under the “src/model”
package, create Card class
• Add the code snippet shown below to the Card class.
package model;
THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE |
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.Icon;
import javax.swing.JLabel;
import controller.cardController;
public class Card extends JLabel implements MouseListener{
// data fields
Icon faceIcon;
Icon backIcon;
//card is initially face down
boolean faceUp = false;
//card number
int num;
//half the dimensions of the back face icon
int iconWidthHalf, iconHeightHalf;
boolean mousePressedOnMe = false;
cardController controller;
/**
* Constructor
* @param face face of the card, two cards have the same face
* @param back back of the card
* @param num number corresponding to the face icon
*/
public Card(cardController controller, Icon face, Icon back, int num){
super(back); //initially all cards face down
this.controller=controller;
this.faceIcon=face;
this.backIcon=back;
this.num=num;
//catch mouse clicks
this.addMouseListener(this);
//(face or back) dimensions for mouse click testing
this.iconHeightHalf=back.getIconHeight()/2;
this.iconWidthHalf=face.getIconWidth()/2;
}
public int getNum(){return num;}//return the number of the card
/**
* Check the coordinates for mouse click
* @param x
* @param y
* @return
*/
private boolean overIcon(int x, int y){
int distX=Math.abs(x-(this.getWidth()/2));
int distY=Math.abs(y-(this.getHeight()/2));
//outside
if (distX>this.iconWidthHalf||distY>this.iconHeightHalf)
return false;
//inside
return true;
}
/**
THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE |
* turn face up
*/
public void turnUp(){
if (this.faceUp) return;
//this.faceUp=true; controller result checked in here
this.faceUp=this.controller.turnUp(this);
if(this.faceUp) this.setIcon(this.faceIcon);
}
public void turnDown(){
if (!this.faceUp)return;
this.setIcon(this.backIcon);
this.faceUp=false; //card is now down
}
@Override
public void mouseClicked(MouseEvent arg0) {
// TODO Auto-generated method stub
if (overIcon(arg0.getX(), arg0.getY())) this.turnUp();
}
@Override
public void mouseEntered(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent arg0) {
// TODO Auto-generated method stub
this.mousePressedOnMe=false;
}
@Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
if (overIcon(arg0.getX(),arg0.getY()))this.mousePressedOnMe=true;
}
@Override
public void mouseReleased(MouseEvent arg0) {
// TODO Auto-generated method stub
if (this.mousePressedOnMe){
this.mousePressedOnMe=false;
this.mouseClicked(arg0);
}
}
}
2.3 MATCHINGGAME CLASS
• We need to create matchıngGame class to create main window.
• Create new class called matchıngGame under the “src/view” package.
package view;
THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE |
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import controller.cardController;
import model.Card;
public class matchingGame implements ActionListener{
//data fields
private JFrame mainFrame; //main window
private Container mainContentPane;//card holder
private ImageIcon cardIcon[]; //0-7 front side of the card; 8 back side
private static void newMenuItem(String text, JMenu menu, ActionListener listener){
JMenuItem newItem=new JMenuItem(text);
newItem.setActionCommand(text);
newItem.addActionListener(listener);
menu.add(newItem);
}
/**
* Default constructor for the game.
* Makes main windows and allocate the card and images
*/
public matchingGame(){
//main window
this.mainFrame=new JFrame("Matching Game");
this.mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.mainFrame.setSize(400, 500);
this.mainContentPane=this.mainFrame.getContentPane();
this.mainContentPane.setLayout(new
BoxLayout(this.mainContentPane,BoxLayout.PAGE_AXIS));
//Menu Bar
JMenuBar menuBar=new JMenuBar();
this.mainFrame.setJMenuBar(menuBar);
//Game Menu
JMenu gameMenu=new JMenu("Game");
menuBar.add(gameMenu);
newMenuItem("New Game", gameMenu,this);
newMenuItem("Exit",gameMenu,this);
//About Menu
JMenu aboutMenu=new JMenu("About");
menuBar.add(aboutMenu);
newMenuItem("Help etc.", aboutMenu,this);//we need to create generic
//newMenuItem
newMenuItem("About",aboutMenu,this);
THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE |
menuBar.add(aboutMenu);
// we need to load cards
this.cardIcon=loadCardIcons();
}
private ImageIcon[] loadCardIcons(){
// first we need to create resources for the icons
ImageIcon icon[]=new ImageIcon[9];
for (int i=0; i<9;i++){
String fileName="images/default/card"+i+".jpg";
icon[i]=new ImageIcon(fileName);
}
return icon;
}
public JPanel makeCards(){
JPanel panel=new JPanel(new GridLayout(4,4));
//all card have same back side (down)
ImageIcon backIcon=this.cardIcon[8]; //which is the back side
cardController controller=new cardController();
int cardsToAdd[]=new int[16];
for (int i=0;i<8;i++){
cardsToAdd[2*i]=i;
cardsToAdd[2*i+1]=i;
}
//we need to randomize them later
randomizeCardArray(cardsToAdd);
//we need to make card object
for (int i=0;i<cardsToAdd.length;i++){
int num=cardsToAdd[i];
Card newCard=new Card(controller, this.cardIcon[num], backIcon, num);
panel.add(newCard);
}
return panel;
}
private void randomizeCardArray(int[] t) {
// TODO Auto-generated method stub
Random randomizer=new Random();
//
for(int i=0;i<t.length;i++){
int d=randomizer.nextInt(t.length);
//swap
int s=t[d];
t[d]=t[i];
t[i]=s;
}
//so we need to controller that control the card behaviors
}
public void newGame(){
this.mainContentPane.removeAll();
//make a new card set visible
this.mainContentPane.add(makeCards());
//show main window
THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE |
this.mainFrame.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if (e.getActionCommand().equals("New Game")) newGame();
if (e.getActionCommand().equals("Exit")) System.exit(0);
}
}
2.4 MAIN CLASS
• We need to add Main class for test the what we’ve done.
• First we need to create Main class as a new class under the “src” package
import view.matchingGame;
public class Main {
public static void main (String[] argv){
matchingGame instance=new matchingGame();
instance.newGame();
}
}
2.5 CARDCONTROLLER CLASS
• Create the cardController class under the “src/controller”.
package controller;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import model.Card;
import java.util.Vector;
public class cardController implements ActionListener{
//data fields
private Vector turnedCards;
private Timer turnDownTimer;
private final int turnDownDelay=2000;
public cardController(){
this.turnedCards=new Vector(2);
this.turnDownTimer=new Timer(this.turnDownDelay, this);
this.turnDownTimer.setRepeats(false);
}
private boolean doAddCard(Card card){
THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE |
this.turnedCards.add(card);
if (this.turnedCards.size()==2){
Card otherCard=(Card)this.turnedCards.get(0);
if(otherCard.getNum()==card.getNum())
this.turnedCards.clear();
else this.turnDownTimer.start();
}
return true;
}
public boolean turnUp(Card card){
if (this.turnedCards.size()<2)return doAddCard(card);
return false;
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
for (int i=0;i< this.turnedCards.size();i++){
Card card=(Card)this.turnedCards.get(i);
card.turnDown();
}
this.turnedCards.clear();
// we need to add this controller to the Card class and also we need to use
// methods in the view class
}
}
2.6 HOMEWORKS
1. Add window components (JTextField, JLabel etc.) to count and show the turn attempts.
2. Make changes in menubar to select different card pictures from menu called "Card Type".
3. Card type menu has submenu item called “Cars”, “Flowers” etc. User can select the different card style to play
the game.
Have fun.
THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE |
2.7 FILE STRUCTURES
3 CONTACT
Dr. Celal Murat KANDEMİR
Eskisehir Osmangazi University
Faculty of Education
kandemir@ogu.edu.tr
twitter.com/cmkandemir

More Related Content

Viewers also liked

İnternet Tabanlı Programlama Uygulama Notları
İnternet Tabanlı Programlama Uygulama Notlarıİnternet Tabanlı Programlama Uygulama Notları
İnternet Tabanlı Programlama Uygulama Notlarıcmkandemir
 
PHP ve MySQL Bağlantısı - Temel İşlemler
PHP ve MySQL Bağlantısı - Temel İşlemlerPHP ve MySQL Bağlantısı - Temel İşlemler
PHP ve MySQL Bağlantısı - Temel İşlemlercmkandemir
 
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 2
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 2Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 2
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 2cmkandemir
 
Kod Akış Kontrolü - Döngüler, Fonksiyonlar
Kod Akış Kontrolü - Döngüler, FonksiyonlarKod Akış Kontrolü - Döngüler, Fonksiyonlar
Kod Akış Kontrolü - Döngüler, Fonksiyonlarcmkandemir
 
openCV and Java - Face Detection
openCV and Java - Face DetectionopenCV and Java - Face Detection
openCV and Java - Face Detectioncmkandemir
 
JDK and Eclipse Installation and Configuration
JDK and Eclipse Installation and ConfigurationJDK and Eclipse Installation and Configuration
JDK and Eclipse Installation and Configurationcmkandemir
 
Chapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 InstructionsChapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 Instructionscmkandemir
 
Chapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional InstructionsChapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional Instructionscmkandemir
 
impress.js Framework
impress.js Frameworkimpress.js Framework
impress.js Frameworkcmkandemir
 
Web Sitesi Geliştirme Adımları
Web Sitesi Geliştirme AdımlarıWeb Sitesi Geliştirme Adımları
Web Sitesi Geliştirme Adımlarıcmkandemir
 
Threads and Game Programming In Java
Threads and Game Programming In JavaThreads and Game Programming In Java
Threads and Game Programming In Javacmkandemir
 
CSS Uygulamaları 1
CSS Uygulamaları 1CSS Uygulamaları 1
CSS Uygulamaları 1cmkandemir
 
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 1
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 1Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 1
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 1cmkandemir
 
CSS - Sunum Bileşenleri
CSS - Sunum BileşenleriCSS - Sunum Bileşenleri
CSS - Sunum Bileşenlericmkandemir
 

Viewers also liked (15)

İnternet Tabanlı Programlama Uygulama Notları
İnternet Tabanlı Programlama Uygulama Notlarıİnternet Tabanlı Programlama Uygulama Notları
İnternet Tabanlı Programlama Uygulama Notları
 
PHP ve MySQL Bağlantısı - Temel İşlemler
PHP ve MySQL Bağlantısı - Temel İşlemlerPHP ve MySQL Bağlantısı - Temel İşlemler
PHP ve MySQL Bağlantısı - Temel İşlemler
 
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 2
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 2Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 2
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 2
 
Kod Akış Kontrolü - Döngüler, Fonksiyonlar
Kod Akış Kontrolü - Döngüler, FonksiyonlarKod Akış Kontrolü - Döngüler, Fonksiyonlar
Kod Akış Kontrolü - Döngüler, Fonksiyonlar
 
openCV and Java - Face Detection
openCV and Java - Face DetectionopenCV and Java - Face Detection
openCV and Java - Face Detection
 
PHP Temelleri
PHP TemelleriPHP Temelleri
PHP Temelleri
 
JDK and Eclipse Installation and Configuration
JDK and Eclipse Installation and ConfigurationJDK and Eclipse Installation and Configuration
JDK and Eclipse Installation and Configuration
 
Chapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 InstructionsChapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 Instructions
 
Chapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional InstructionsChapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional Instructions
 
impress.js Framework
impress.js Frameworkimpress.js Framework
impress.js Framework
 
Web Sitesi Geliştirme Adımları
Web Sitesi Geliştirme AdımlarıWeb Sitesi Geliştirme Adımları
Web Sitesi Geliştirme Adımları
 
Threads and Game Programming In Java
Threads and Game Programming In JavaThreads and Game Programming In Java
Threads and Game Programming In Java
 
CSS Uygulamaları 1
CSS Uygulamaları 1CSS Uygulamaları 1
CSS Uygulamaları 1
 
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 1
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 1Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 1
Canvas Öğrenme Yönetim Sistemi Kullanım Kılavuzu Bölüm 1
 
CSS - Sunum Bileşenleri
CSS - Sunum BileşenleriCSS - Sunum Bileşenleri
CSS - Sunum Bileşenleri
 

Similar to Matching Game In Java

Please help!!I wanted to know how to add a high score to this prog.pdf
Please help!!I wanted to know how to add a high score to this prog.pdfPlease help!!I wanted to know how to add a high score to this prog.pdf
Please help!!I wanted to know how to add a high score to this prog.pdfJUSTSTYLISH3B2MOHALI
 
This is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdfThis is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdfanjandavid
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best PracticesYekmer Simsek
 
Secrets of JavaScript Libraries
Secrets of JavaScript LibrariesSecrets of JavaScript Libraries
Secrets of JavaScript Librariesjeresig
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesAnkit Rastogi
 
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...DroidConTLV
 
Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!Stacy Devino
 
I wanted to change the cloudsrectangles into an actuall image it do.pdf
I wanted to change the cloudsrectangles into an actuall image it do.pdfI wanted to change the cloudsrectangles into an actuall image it do.pdf
I wanted to change the cloudsrectangles into an actuall image it do.pdffeelinggifts
 
The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]Nilhcem
 
Settings
SettingsSettings
Settingsyito24
 
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docxDAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docxtheodorelove43763
 
Introduction to CQRS and Event Sourcing
Introduction to CQRS and Event SourcingIntroduction to CQRS and Event Sourcing
Introduction to CQRS and Event SourcingSamuel ROZE
 
Androidaop 170105090257
Androidaop 170105090257Androidaop 170105090257
Androidaop 170105090257newegg
 

Similar to Matching Game In Java (20)

Please help!!I wanted to know how to add a high score to this prog.pdf
Please help!!I wanted to know how to add a high score to this prog.pdfPlease help!!I wanted to know how to add a high score to this prog.pdf
Please help!!I wanted to know how to add a high score to this prog.pdf
 
This is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdfThis is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdf
 
Java awt
Java awtJava awt
Java awt
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 
Secrets of JavaScript Libraries
Secrets of JavaScript LibrariesSecrets of JavaScript Libraries
Secrets of JavaScript Libraries
 
Maze
MazeMaze
Maze
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practices
 
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
 
Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!
 
I wanted to change the cloudsrectangles into an actuall image it do.pdf
I wanted to change the cloudsrectangles into an actuall image it do.pdfI wanted to change the cloudsrectangles into an actuall image it do.pdf
I wanted to change the cloudsrectangles into an actuall image it do.pdf
 
The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
Unittests für Dummies
Unittests für DummiesUnittests für Dummies
Unittests für Dummies
 
Settings
SettingsSettings
Settings
 
Dojo and Adobe AIR
Dojo and Adobe AIRDojo and Adobe AIR
Dojo and Adobe AIR
 
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docxDAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
DAOFactory.javaDAOFactory.javapublicclassDAOFactory{ this .docx
 
A More Flash Like Web?
A More Flash Like Web?A More Flash Like Web?
A More Flash Like Web?
 
Introduction to CQRS and Event Sourcing
Introduction to CQRS and Event SourcingIntroduction to CQRS and Event Sourcing
Introduction to CQRS and Event Sourcing
 
Day 5
Day 5Day 5
Day 5
 
Androidaop 170105090257
Androidaop 170105090257Androidaop 170105090257
Androidaop 170105090257
 

More from cmkandemir

Temel HTML Etiketleri ve Kullanım Örnekleri
Temel HTML Etiketleri ve Kullanım ÖrnekleriTemel HTML Etiketleri ve Kullanım Örnekleri
Temel HTML Etiketleri ve Kullanım Örneklericmkandemir
 
Yapay Zeka Nedir?
Yapay Zeka Nedir?Yapay Zeka Nedir?
Yapay Zeka Nedir?cmkandemir
 
Zekayı Anlamak
Zekayı AnlamakZekayı Anlamak
Zekayı Anlamakcmkandemir
 
PHP - Kullanıcı Girişlerinin İşlenmesi
PHP - Kullanıcı Girişlerinin İşlenmesiPHP - Kullanıcı Girişlerinin İşlenmesi
PHP - Kullanıcı Girişlerinin İşlenmesicmkandemir
 
Chapter 2-8085 Microprocessor Architecture and Microcomputer Systems
Chapter 2-8085 Microprocessor Architecture and Microcomputer SystemsChapter 2-8085 Microprocessor Architecture and Microcomputer Systems
Chapter 2-8085 Microprocessor Architecture and Microcomputer Systemscmkandemir
 
Chapter 1-Microprocessors, Microcomputers, and Assembly Language
Chapter 1-Microprocessors, Microcomputers, and Assembly LanguageChapter 1-Microprocessors, Microcomputers, and Assembly Language
Chapter 1-Microprocessors, Microcomputers, and Assembly Languagecmkandemir
 
CSS - Genel Bakış
CSS - Genel BakışCSS - Genel Bakış
CSS - Genel Bakışcmkandemir
 
Temel HTML Etiketleri - Tablo, Form
Temel HTML Etiketleri - Tablo, FormTemel HTML Etiketleri - Tablo, Form
Temel HTML Etiketleri - Tablo, Formcmkandemir
 
Temel HTML Etiketleri - Text, Image, Link, List, Image
Temel HTML Etiketleri - Text, Image, Link, List, ImageTemel HTML Etiketleri - Text, Image, Link, List, Image
Temel HTML Etiketleri - Text, Image, Link, List, Imagecmkandemir
 
Vaadin JPAContainer
Vaadin JPAContainerVaadin JPAContainer
Vaadin JPAContainercmkandemir
 

More from cmkandemir (10)

Temel HTML Etiketleri ve Kullanım Örnekleri
Temel HTML Etiketleri ve Kullanım ÖrnekleriTemel HTML Etiketleri ve Kullanım Örnekleri
Temel HTML Etiketleri ve Kullanım Örnekleri
 
Yapay Zeka Nedir?
Yapay Zeka Nedir?Yapay Zeka Nedir?
Yapay Zeka Nedir?
 
Zekayı Anlamak
Zekayı AnlamakZekayı Anlamak
Zekayı Anlamak
 
PHP - Kullanıcı Girişlerinin İşlenmesi
PHP - Kullanıcı Girişlerinin İşlenmesiPHP - Kullanıcı Girişlerinin İşlenmesi
PHP - Kullanıcı Girişlerinin İşlenmesi
 
Chapter 2-8085 Microprocessor Architecture and Microcomputer Systems
Chapter 2-8085 Microprocessor Architecture and Microcomputer SystemsChapter 2-8085 Microprocessor Architecture and Microcomputer Systems
Chapter 2-8085 Microprocessor Architecture and Microcomputer Systems
 
Chapter 1-Microprocessors, Microcomputers, and Assembly Language
Chapter 1-Microprocessors, Microcomputers, and Assembly LanguageChapter 1-Microprocessors, Microcomputers, and Assembly Language
Chapter 1-Microprocessors, Microcomputers, and Assembly Language
 
CSS - Genel Bakış
CSS - Genel BakışCSS - Genel Bakış
CSS - Genel Bakış
 
Temel HTML Etiketleri - Tablo, Form
Temel HTML Etiketleri - Tablo, FormTemel HTML Etiketleri - Tablo, Form
Temel HTML Etiketleri - Tablo, Form
 
Temel HTML Etiketleri - Text, Image, Link, List, Image
Temel HTML Etiketleri - Text, Image, Link, List, ImageTemel HTML Etiketleri - Text, Image, Link, List, Image
Temel HTML Etiketleri - Text, Image, Link, List, Image
 
Vaadin JPAContainer
Vaadin JPAContainerVaadin JPAContainer
Vaadin JPAContainer
 

Recently uploaded

Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 

Recently uploaded (20)

Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 

Matching Game In Java

  • 1. THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE | Advanced Programming Lab Notes Matching Game In Java 1 RESOURCES • Package java.awt (Container, GridLayout, event package) o http://docs.oracle.com/javase/8/docs/api/java/awt/package-frame.html • Package javax.swing (window components and also Timer class) o http://docs.oracle.com/javase/8/docs/api/javax/swing/package-frame.html • Package java.util (Vector, Random) o https://docs.oracle.com/javase/tutorial/essential/concurrency/runthread.html 2 LAB SESSION 2.1 CREATE A NEW PROJECT • Select File->New->Java Project • “Under Create a Java Project” dialog box, for the Project Name field, type in matchingGame as project name 2.2 CREATE A CARD CLASS • Under the “src/model” package, create Card class • Add the code snippet shown below to the Card class. package model;
  • 2. THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE | import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.Icon; import javax.swing.JLabel; import controller.cardController; public class Card extends JLabel implements MouseListener{ // data fields Icon faceIcon; Icon backIcon; //card is initially face down boolean faceUp = false; //card number int num; //half the dimensions of the back face icon int iconWidthHalf, iconHeightHalf; boolean mousePressedOnMe = false; cardController controller; /** * Constructor * @param face face of the card, two cards have the same face * @param back back of the card * @param num number corresponding to the face icon */ public Card(cardController controller, Icon face, Icon back, int num){ super(back); //initially all cards face down this.controller=controller; this.faceIcon=face; this.backIcon=back; this.num=num; //catch mouse clicks this.addMouseListener(this); //(face or back) dimensions for mouse click testing this.iconHeightHalf=back.getIconHeight()/2; this.iconWidthHalf=face.getIconWidth()/2; } public int getNum(){return num;}//return the number of the card /** * Check the coordinates for mouse click * @param x * @param y * @return */ private boolean overIcon(int x, int y){ int distX=Math.abs(x-(this.getWidth()/2)); int distY=Math.abs(y-(this.getHeight()/2)); //outside if (distX>this.iconWidthHalf||distY>this.iconHeightHalf) return false; //inside return true; } /**
  • 3. THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE | * turn face up */ public void turnUp(){ if (this.faceUp) return; //this.faceUp=true; controller result checked in here this.faceUp=this.controller.turnUp(this); if(this.faceUp) this.setIcon(this.faceIcon); } public void turnDown(){ if (!this.faceUp)return; this.setIcon(this.backIcon); this.faceUp=false; //card is now down } @Override public void mouseClicked(MouseEvent arg0) { // TODO Auto-generated method stub if (overIcon(arg0.getX(), arg0.getY())) this.turnUp(); } @Override public void mouseEntered(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent arg0) { // TODO Auto-generated method stub this.mousePressedOnMe=false; } @Override public void mousePressed(MouseEvent arg0) { // TODO Auto-generated method stub if (overIcon(arg0.getX(),arg0.getY()))this.mousePressedOnMe=true; } @Override public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub if (this.mousePressedOnMe){ this.mousePressedOnMe=false; this.mouseClicked(arg0); } } } 2.3 MATCHINGGAME CLASS • We need to create matchıngGame class to create main window. • Create new class called matchıngGame under the “src/view” package. package view;
  • 4. THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE | import java.awt.Container; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import controller.cardController; import model.Card; public class matchingGame implements ActionListener{ //data fields private JFrame mainFrame; //main window private Container mainContentPane;//card holder private ImageIcon cardIcon[]; //0-7 front side of the card; 8 back side private static void newMenuItem(String text, JMenu menu, ActionListener listener){ JMenuItem newItem=new JMenuItem(text); newItem.setActionCommand(text); newItem.addActionListener(listener); menu.add(newItem); } /** * Default constructor for the game. * Makes main windows and allocate the card and images */ public matchingGame(){ //main window this.mainFrame=new JFrame("Matching Game"); this.mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.mainFrame.setSize(400, 500); this.mainContentPane=this.mainFrame.getContentPane(); this.mainContentPane.setLayout(new BoxLayout(this.mainContentPane,BoxLayout.PAGE_AXIS)); //Menu Bar JMenuBar menuBar=new JMenuBar(); this.mainFrame.setJMenuBar(menuBar); //Game Menu JMenu gameMenu=new JMenu("Game"); menuBar.add(gameMenu); newMenuItem("New Game", gameMenu,this); newMenuItem("Exit",gameMenu,this); //About Menu JMenu aboutMenu=new JMenu("About"); menuBar.add(aboutMenu); newMenuItem("Help etc.", aboutMenu,this);//we need to create generic //newMenuItem newMenuItem("About",aboutMenu,this);
  • 5. THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE | menuBar.add(aboutMenu); // we need to load cards this.cardIcon=loadCardIcons(); } private ImageIcon[] loadCardIcons(){ // first we need to create resources for the icons ImageIcon icon[]=new ImageIcon[9]; for (int i=0; i<9;i++){ String fileName="images/default/card"+i+".jpg"; icon[i]=new ImageIcon(fileName); } return icon; } public JPanel makeCards(){ JPanel panel=new JPanel(new GridLayout(4,4)); //all card have same back side (down) ImageIcon backIcon=this.cardIcon[8]; //which is the back side cardController controller=new cardController(); int cardsToAdd[]=new int[16]; for (int i=0;i<8;i++){ cardsToAdd[2*i]=i; cardsToAdd[2*i+1]=i; } //we need to randomize them later randomizeCardArray(cardsToAdd); //we need to make card object for (int i=0;i<cardsToAdd.length;i++){ int num=cardsToAdd[i]; Card newCard=new Card(controller, this.cardIcon[num], backIcon, num); panel.add(newCard); } return panel; } private void randomizeCardArray(int[] t) { // TODO Auto-generated method stub Random randomizer=new Random(); // for(int i=0;i<t.length;i++){ int d=randomizer.nextInt(t.length); //swap int s=t[d]; t[d]=t[i]; t[i]=s; } //so we need to controller that control the card behaviors } public void newGame(){ this.mainContentPane.removeAll(); //make a new card set visible this.mainContentPane.add(makeCards()); //show main window
  • 6. THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE | this.mainFrame.setVisible(true); } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if (e.getActionCommand().equals("New Game")) newGame(); if (e.getActionCommand().equals("Exit")) System.exit(0); } } 2.4 MAIN CLASS • We need to add Main class for test the what we’ve done. • First we need to create Main class as a new class under the “src” package import view.matchingGame; public class Main { public static void main (String[] argv){ matchingGame instance=new matchingGame(); instance.newGame(); } } 2.5 CARDCONTROLLER CLASS • Create the cardController class under the “src/controller”. package controller; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Timer; import model.Card; import java.util.Vector; public class cardController implements ActionListener{ //data fields private Vector turnedCards; private Timer turnDownTimer; private final int turnDownDelay=2000; public cardController(){ this.turnedCards=new Vector(2); this.turnDownTimer=new Timer(this.turnDownDelay, this); this.turnDownTimer.setRepeats(false); } private boolean doAddCard(Card card){
  • 7. THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE | this.turnedCards.add(card); if (this.turnedCards.size()==2){ Card otherCard=(Card)this.turnedCards.get(0); if(otherCard.getNum()==card.getNum()) this.turnedCards.clear(); else this.turnDownTimer.start(); } return true; } public boolean turnUp(Card card){ if (this.turnedCards.size()<2)return doAddCard(card); return false; } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub for (int i=0;i< this.turnedCards.size();i++){ Card card=(Card)this.turnedCards.get(i); card.turnDown(); } this.turnedCards.clear(); // we need to add this controller to the Card class and also we need to use // methods in the view class } } 2.6 HOMEWORKS 1. Add window components (JTextField, JLabel etc.) to count and show the turn attempts. 2. Make changes in menubar to select different card pictures from menu called "Card Type". 3. Card type menu has submenu item called “Cars”, “Flowers” etc. User can select the different card style to play the game. Have fun.
  • 8. THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE | 2.7 FILE STRUCTURES 3 CONTACT Dr. Celal Murat KANDEMİR Eskisehir Osmangazi University Faculty of Education kandemir@ogu.edu.tr twitter.com/cmkandemir