package fr.iutfbleau.Quiz;

import java.awt.*;
import javax.swing.*;


public class AffichageQuestion extends JFrame {

	private Question questions;
	private int compteur;

	public AffichageQuestion(Question questions) {
		this.questions = questions;
		this.compteur = 1;

		this.setSize(400, 700);
		this.setLocation(100, 100);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		this.setLayout(new GridBagLayout());

		GridBagConstraints gbc = new GridBagConstraints();

		gbc.gridx = 1;
		gbc.gridy = 0;
		gbc.gridwidth = 4;
		gbc.gridheight = 4;

		gbc.fill = GridBagConstraints.NONE;

		gbc.insets = new Insets(5, 5, 5, 5);

		JLabel intitule = new JLabel(questions.getIntitule());
		this.add(intitule);

		JLabel compteur = new JLabel("" + this.compteur);

		gbc.gridx = 5;
		gbc.insets = new Insets(0, 0, 0, 0);

		this.add(intitule);

		gbc.gridy = 2;
		gbc.gridx = 2;
		gbc.gridwidth = 2;

		for (int i = 0; i != this.questions.getOptions().length; i++) {
			JButton option = new JButton(this.questions.getOptions()[i]);
			this.add(option);
			gbc.gridy++;
			gbc.insets = new Insets(0, 0, 0, 5);
		}

	}

}