JAVA 프로그래밍

문제

16장의 카드에서 같은 색을 가진 카드 짝을 찾는 문제입니다 이를 해결하는 다음 프로그램에 대해 빈칸을 채우세요 
 

코드 빈칸 채우기

import javax.swing.*; 
	 
public  CardMatchingGameMain 
{ 
	public static void main(String [] args)  
	{ 
		final int[][] color = { { 0, 1, 2, 7 }, 
		                        { 3, 5, 6, 0 }, 
		                        { 2, 4, 6, 3 }, 
		                        { 4, 5, 1, 7 } }; 
 
		 frame = new  ( "같은 색깔 찾기" ); 
		frame.getContentPane().( new CardMatchingPanel( color ) ); 
		frame.pack(); 
		frame.setVisible(true); 
		frame.setDefaultCloseOperation( .EXIT_ON_CLOSE ); 
	} 
} 
 
import java.awt.*; 
import java.awt.event.*; 
import javax.swing.*; 
	 
public  CardMatchingPanel   { 
	protected Card card1, card2; 
 
	public CardMatchingPanel( int[][] color ) { 
		card1 = null; 
		card2 = null; 
		( new ( color., color[0]. ) ); 
		setPreferredSize( new Dimension( 400, 400 ) );		 
		setFocusable( true ); 
		requestFocus(); 
		 
		Card[][] card = new Card[color.][color[0].];  
		ClickListener click = new ClickListener();  
		Color[] palette = { Color.pink, Color.red, Color.orange, Color.yellow, Color.green, Color.blue, Color.cyan, Color.gray }; 
		for( int y=0; y < card.; y++ ){ 
			for( int x=0; x < card[0].; x++ ){ 
				card[y][x] =  
				             new Card( palette[ color[y][x] ] ); 
				card[y][x].( click ); 
				( card[y][x] ); 
			} 
		} 
	} 
 
	private  ClickListener   { 
		public void (  event ) { 
			if ( ( card1  null ) && ( card2  null ) ) { 
				if ( !card1.color().( card2.color() ) ) { 
					card1.unselected(); 
					card2.unselected(); 
				} 
 
				card1 = null; 
				card2 = null; 
			} 
 
			if ( card1  null  ) { 
				card1 = (Card)event.(); 
				card1.selected(); 
			} 
			else if ( card2  null  ) { 
				card2 = (Card)event.(); 
				card2.selected(); 
			} 
		} 
	} 
} 
 
import java.awt.*; 
import javax.swing.*; 
	 
public  Card   { 
	private Color color; 
	 
	public Card( Color color ) { 
		super(); 
		this.color = color; 
		this.( Color.white ); 
	} 
	 
	public void selected() { 
		this.( false ); 
		this.( this.color ); 
	} 
	 
	public void unselected() { 
		this.( true ); 
		this.( Color.white ); 
	} 
	 
	public Color color() { 
		return this.color; 
	} 
}