public void paint(Graphics g)
	{
		g.setColor(new Color(0,255,0));
		g.fillRect(0,0,600,400);
		Color s[]={new Color(255,255,255),new Color(0,0,0)};
		g.setColor(s[1]);
		g.fillRect(60,60,316,316);
		for(int r=7;r>=0;r--)
		{
			for(int f=0;f<8;f++)
			{
				g.setColor(s[((r&1)+(f&1))&1]);
				g.fillRect(f*35+78,(7-r)*35+78,35,35);
				if(r==0)
				{
					g.setColor(s[0]);
					g.drawString(new String(""+(char)(f+'a')),f*35+93,370);
				}
			}
			g.setColor(s[0]);
			g.drawString(new String(""+(char)(r+'1')),65,(7-r)*35+96);
		}
		for(int r=7;r>=0;r--)
		{
			for(int f=0;f<8;f++)
			{
				if(b.c[(r<<4)+f]!=0)
					if(!g.drawImage(p[b.c[(r<<4)+f]-1][b.p[(r<<4)+f]-1],f*35+78,(7-r)*35+78,this))
						System.out.println("S");
			}
		}
		Toolkit.getDefaultToolkit().sync();
	}
}

class settings extends JFrame implements ChangeListener
{
    private JButton jButton1;
    private JButton jButton2;
    private JLabel jLabel2;
    private JLabel jLabel3;
    private JLabel jLabel4;
    private JSeparator jSeparator1;
    private JSeparator jSeparator2;
    private JTextField jTextField1;
    private JTextField jTextField2;
    private ArrayList al;
    public settings(board b,ArrayList a)
    {
        jTextField1 = new JTextField();
        jTextField2 = new JTextField();
        jLabel2 = new JLabel();
        jLabel3 = new JLabel();
        jLabel4 = new JLabel();
        jSeparator1 = new JSeparator();
        jSeparator2 = new JSeparator();
        jButton1 = new JButton();
        jButton2 = new JButton();
        al=a;

        getContentPane().setLayout(null);

        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent evt) {
            	dispose();
            }
        });

        jTextField1.setColumns(10);
        jTextField1.setText(b.md+"");
        getContentPane().add(jTextField1);
        jTextField1.setBounds(110, 50, 30, 20);

        jLabel2.setText("Max Depth:");
        getContentPane().add(jLabel2);
        jLabel2.setBounds(30, 50, 70, 16);

        jLabel3.setText("Engine Settings");
        getContentPane().add(jLabel3);
        jLabel3.setBounds(40, 20, 90, 16);

        jLabel4.setText("Setup FEN");
        getContentPane().add(jLabel4);
        jLabel4.setBounds(190, 40, 80, 16);

        jTextField2.setColumns(100);
        jTextField2.setText("");
        getContentPane().add(jTextField2);
        jTextField2.setBounds(280, 40, 80, 20);

        getContentPane().add(jSeparator1);
        jSeparator1.setBounds(20, 40, 130, 10);

        jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);
        getContentPane().add(jSeparator2);
        jSeparator2.setBounds(170, 10, 10, 250);

        jButton1.setText("OK");
        getContentPane().add(jButton1);
        jButton1.setBounds(350, 240, 51, 26);

        jButton2.setText("Cancel");
        getContentPane().add(jButton2);
        jButton2.setBounds(260, 240, 73, 26);

		jButton1.addChangeListener(this);
		jButton2.addChangeListener(this);
        pack();
    }
    public void stateChanged(ChangeEvent c)
    {
    	if(c.getSource()==jButton1)
    	{
    		al.add("sd "+jTextField1.getText());
		al.add("setboard "+jTextField2.getText());
    	}
    	dispose();
    }