1 2 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
| import javax.swing.* ;
import java.awt.* ;
import java.awt.event.* ;
import javax.swing.event.*;
class Fenetre extends JFrame implements ActionListener
{ public Fenetre ()
{ setTitle ("Telephone") ;
setSize (300, 200) ;
detail = new JButton ("Details +/-") ;
getContentPane().setLayout(new FlowLayout());
getContentPane().add(detail) ;
detail.addActionListener(this);
decrocher = new JButton ("Decrocher") ;
getContentPane().setLayout(new FlowLayout());
getContentPane().add(decrocher) ;
decrocher.addActionListener(this);
raccrocher = new JButton ("Raccrocher") ;
getContentPane().setLayout(new FlowLayout());
getContentPane().add(raccrocher) ;
raccrocher.addActionListener(this);
JTabbedPane monPanneau = new JTabbedPane();
JPanel pan1 = new JPanel(new BorderLayout());
JPanel pan2 = new JPanel(new BorderLayout());
JPanel pan3 = new JPanel(new BorderLayout());
monPanneau.addTab("Repertoire", pan1);
monPanneau.addTab("Messagerie vocale", pan2);
monPanneau.addTab("Configuration", pan3);
getContentPane().add(monPanneau,BorderLayout.SOUTH);
JMenuBar barreMenu = new JMenuBar();
setJMenuBar(barreMenu);
JMenu Fichier = new JMenu("Fichier");
barreMenu.add(Fichier);
JMenu Edition = new JMenu("Edition");
barreMenu.add(Edition);
JMenu Aide = new JMenu("Aide");
barreMenu.add(Aide);
Container contenu = getContentPane();
JToolBar barreOutil = new JToolBar();
JButton boutonCut = new JButton(new ImageIcon("C:/Users/timo/Documents/M1/m1/cut.png"));
barreOutil.add(boutonCut);
JButton boutonCopy = new JButton(new ImageIcon("C:/Users/timo/Documents/M1/m1/copy.png"));
barreOutil.add(boutonCopy);
JButton boutonPaste = new JButton(new ImageIcon("C:/Users/timo/Documents/M1/m1/paste.png"));
barreOutil.add(boutonPaste);
JButton boutonHelp = new JButton(new ImageIcon("C:/Users/timo/Documents/M1/m1/help.png"));
barreOutil.add(boutonHelp);
barreOutil.setFloatable(true);
contenu.add(barreOutil);
JComboBox combo = new JComboBox();
combo.setEditable(true);
combo.setMaximumRowCount(5);
contenu.add(combo);
}
public void actionPerformed (ActionEvent ev)
{ System.out.println ("On veut plus de details") ;
}
private JButton detail ;
private JButton raccrocher;
private JButton decrocher;
} |
Partager