| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 
 | import java.awt.* ; 
import javax.swing.*; 
import java.awt.event.*; 
import java.io.*;
import javax.sound.sampled.*
 
 
public class projet extends JFrame
{
	private JPanel panneau = new JPanel(); 
	private JLabel lib1 = new JLabel ("Projet été 2007");
	private JButton but1 = new JButton("Menu1");
	private JButton but2 = new JButton("Menu2");
	private JButton but3 = new JButton("Menu3");
	private JButton but4 = new JButton("Quitter");
 
	public projet (String nom, int posX, int posY,int largeur, int hauteur)
	{
		super (nom);
		setBounds(posX, posY, largeur, hauteur); 
		setDefaultCloseOperation(EXIT_ON_CLOSE); 
		setVisible(true);
 
		panneau.setBackground(Color.white);
		lib1.setForeground(Color.black);
		panneau.add(lib1);
		but1.setBackground(Color.white);
		but2.setBackground(Color.white);
		but3.setBackground(Color.white);
		but4.setBackground(Color.white);
		but1.setForeground(Color.blue);
		but2.setForeground(Color.blue);
		but3.setForeground(Color.blue);
		but4.setForeground(Color.blue);
		but1.addMouseListener(new MouseListener()
		{
			public void mouseClicked(MouseEvent e){}
			public void mouseEntered(MouseEvent e)
			{
				but1.setBackground(Color.blue);
				but1.setForeground(Color.white);
			}
			public void mouseExited(MouseEvent e)
			{
				but1.setBackground(Color.white);
				but1.setForeground(Color.blue);
			}
			public void mousePressed(MouseEvent e){}
			public void mouseReleased(MouseEvent e){}
		});
		panneau.add(but1);
		but2.addMouseListener(new MouseListener()
		{
			public void mouseClicked(MouseEvent e){}
			public void mouseEntered(MouseEvent e)
			{
				but2.setBackground(Color.blue);
				but2.setForeground(Color.white);
			}
			public void mouseExited(MouseEvent e)
			{
				but2.setBackground(Color.white);
				but2.setForeground(Color.blue);
			}
			public void mousePressed(MouseEvent e){}
			public void mouseReleased(MouseEvent e){}
		});
		panneau.add(but2);
		but3.addMouseListener(new MouseListener()
		{
			public void mouseClicked(MouseEvent e){}
			public void mouseEntered(MouseEvent e)
			{
				but3.setBackground(Color.blue);
				but3.setForeground(Color.white);
			}
			public void mouseExited(MouseEvent e)
			{
				but3.setBackground(Color.white);
				but3.setForeground(Color.blue);
			}
			public void mousePressed(MouseEvent e){}
			public void mouseReleased(MouseEvent e){}
		});
		panneau.add(but3);
		but4.addMouseListener(new MouseListener()
		{
			public void mouseClicked(MouseEvent e)
			{
				System.exit(0);
			}
			public void mouseEntered(MouseEvent e)
			{
				but4.setBackground(Color.blue);
				but4.setForeground(Color.white);
			}
			public void mouseExited(MouseEvent e)
			{
				but4.setBackground(Color.white);
				but4.setForeground(Color.blue);
			}
			public void mousePressed(MouseEvent e){}
			public void mouseReleased(MouseEvent e){}
		});
		panneau.add(but4);
		setContentPane(panneau); 
		setVisible(true); 
	}
} | 
Partager