package Übungen.TicTac;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Color;
import javax.swing.border.LineBorder;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JTextField;
import java.awt.GridLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class View extends JFrame {

	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
	JLabel nameSpieler1;
	JLabel nameSpieler2;
	JLabel anzahlgewinn1;
	JLabel anzahlgewinn2;
	JLabel XoderO;
	JButton[][] x_o;
	
	public View() {
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setBounds(100, 100, 626, 709);
		this.contentPane = new JPanel();
		this.contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JPanel panel = new JPanel();
		panel.setBorder(new LineBorder(new Color(128, 255, 128), 2));
		panel.setBackground(new Color(192, 192, 192));
		panel.setBounds(38, 36, 529, 585);
		contentPane.add(panel);
		panel.setLayout(null);
		
		nameSpieler1 = new JLabel();
		nameSpieler1.setBounds(46, 27, 100, 14);
		panel.add(nameSpieler1);
		
		anzahlgewinn1 = new JLabel();
		anzahlgewinn1.setBounds(46, 52, 100, 14);
		panel.add(anzahlgewinn1);
		
		nameSpieler2 = new JLabel();
		nameSpieler2.setBounds(391, 27, 100, 14);
		panel.add(nameSpieler2);
		
		anzahlgewinn2 = new JLabel();
		anzahlgewinn2.setBounds(391, 52, 100, 14);
		panel.add(anzahlgewinn2);
		
		XoderO = new JLabel("New label");
		XoderO.setBounds(222, 41, 100, 14);
		panel.add(XoderO);
		
		JButton btnNewButton = new JButton("New Game");
		btnNewButton.setBounds(196, 447, 129, 23);
		panel.add(btnNewButton);
		
		JPanel panel_1 = new JPanel();
		panel_1.setBounds(101, 125, 312, 291);
		panel.add(panel_1);
		panel_1.setLayout(new GridLayout(3, 3, 0, 0));
		
		x_o = new JButton[3][3];
		
		for (int i = 0; i < 3; i++) 
			for (int j = 0; j < 3; j++) {
				x_o[i][j] = new JButton("-");
				panel_1.add(x_o[i][j]);
			}
		
		panel.add(panel_1);
		
		this.setVisible(true);
	}
}
