import java.awt.*;
import java.awt.event.*;

class mgui extends Frame
{
	/** main input textfields: **/
	TextField one = new TextField();
	TextField two = new TextField();
	TextField three = new TextField();
	TextField four = new TextField();

	/** buttons **/
	Button newgame = new Button("Start a new Random Game");
	Button ok = new Button("Try if it's right");

	/** number of tries: **/
	int num = 13;

	/** initialize the labels for the number of tries: **/
	Label[][] labels = new Label[4][num];

	/** empty label **/
	Label empty = new Label();

	/** panels **/
	Panel trytable = new Panel();
	Panel numberinput = new Panel();
	Panel inputpanel = new Panel();

	mgui()
	{
		setLayout(new BorderLayout(20, 20));
		trytable.setLayout(new GridLayout(num, 4, 20, 20));
		numberinput.setLayout(new GridLayout(num, 4, 20, 20));
		inputpanel.setLayout(new BorderLayout(20, 20));
		
		/** add the labels to the trytable **/
		for (int i=0; num>i; i++)
		{	
			for (int j=0; labels.length>j; j++)
			{
				System.out.println("i:"+i+"j:"+j);
				labels[j][i] = new Label("i:"+i+"j:"+j);
				trytable.add(labels[j][i]);
			}
		}


		/** add empty fields before the TextFields, to center them **/
		for (int i=0; num*2>i; i++)
		{
			numberinput.add(empty);
		}

		/** add the TextFields and ok button to the numberinput panel at special positions**/
		numberinput.add(one);
		numberinput.add(two);
		numberinput.add(three);
		numberinput.add(four);

		/** merge it with the input panel **/
		inputpanel.add(numberinput, BorderLayout.CENTER);
		/** add ok button **/
		inputpanel.add(ok, BorderLayout.EAST);

		/** put panels into the main window **/
		add(trytable, BorderLayout.WEST);
		add(inputpanel, BorderLayout.CENTER);

		/** add the newgame button **/
		inputpanel.add(newgame, BorderLayout.SOUTH);
	}
}
