All pastes #2023819 Raw Edit

chess

public javascript v1 · immutable
#2023819 ·published 2010-12-19 20:19 UTC
rendered paste body
public class SchackPanel extends JPanel {	private final Dimension PANEL_STORLEK = new Dimension(500,500);	private final Color BAKGRUNDS_FARG = Color.white;		public SchackPanel(int N) 	{				setPreferredSize(PANEL_STORLEK);		setBackground(BAKGRUNDS_FARG);								setLayout(new GridLayout(N,N));				int c= 0;		int x =(int) (N %2);				for (int i = 0; i<N; i++) //rad		{			if (x == c ){											for (int j = 0; j<N; j++)//column				{					if ((int)x == c){											add(new JButton("Button 1"));					}					else					{							add(new JButton("Button 2"));									}			} 				}			else			{					for (int k = 0; k<N; k++)					{					     if (x != c)					{						add(new JButton("Button 2"));					     }									else					     {					         add(new JButton("Button 1"));						}																				}			}			}		}	}