import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JTextField;


public class Exercice2_2 
{
	public static void main(String[] args) 
	{
		JFrame jf = new JFrame("Ma super IHM !");
		jf.setSize(300, 300);
		jf.setLayout(new GridLayout(0,2)); // GridLayout => Crée une grille de 2 colonnes.
		
		/** Barre de menu **/
		JMenuBar m = new JMenuBar();
		
		JMenu menu = new JMenu("Fichier");
		
		JMenuItem item1 = new JMenuItem("Ouvrir..");
		JMenuItem item2 = new JMenuItem("Quitter");
		menu.add(item1);
		menu.add(item2);
		m.add(menu);
		jf.setJMenuBar(m);
		
		/** Composants **/
		
			// Bouton
		JButton bouton = new JButton("Cliquez");
		//bouton.setLocation(0, 0); // Inutile avec un layout non null
		//bouton.setSize(100,30); // Inutile avec un layout non null
		jf.add(bouton);
		
			// Liste déroulante
		//String[] liste = {"Probleme 1", "Probleme 2"};
		String[] liste = {"Probleme 1", "Probleme 2","problem 3","problem 3","problem 3"}; // Les items de ma JList
		JList l = new JList(liste);
		//l.setLocation(120,40);
		//l.setSize(100,35);
		jf.add(l);
		
			// CheckBox
		JCheckBox box = new JCheckBox("Toto");
		//box.setLocation(10,70);
		//box.setSize(100,35);
		jf.add(box);
		
			// Label
		JLabel label = new JLabel("Texte non modifiable", JLabel.CENTER);
		//label.setLocation(0,100);
		//label.setSize(300,35);
		jf.add(label);
		
			// TextField
		JTextField tf = new JTextField("tokoztkozktztokzotk");
		//tf.setLocation(0,130);
		//tf.setSize(100,35);
		jf.add(tf);
		
		jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		jf.setVisible(true);
	}
}
