public class Titre
extends JPanel{
public JButton drapFr;
public JButton drapEng;
public JButton drapViet;
public Titre(String nomPage, String nomFrame) {
this.nomFrame = nomFrame;
ImageIcon drapeauFr = createImageIcon("img/fr.gif");
ImageIcon drapeauEng = createImageIcon("img/en.gif");
ImageIcon drapeauViet = createImageIcon("img/VN.gif");
setPreferredSize(new Dimension(90,60));
setLayout(new FlowLayout(FlowLayout.RIGHT));
drapFr = new JButton(drapeauFr);
drapFr.setPreferredSize(new Dimension(24,16));
add(drapFr);
drapEng = new JButton(drapeauEng);
drapEng.setPreferredSize(new Dimension(24,16));
add(drapEng);
drapViet = new JButton(drapeauViet);
drapViet.setPreferredSize(new Dimension(24,16));
add(drapViet);
nomDeLaFrame();
}
public void nomDeLaFrame() {
if(nomFrame.equalsIgnoreCase("Sommaire")) {
Sommaire summary = new Sommaire();
drapFr.addActionListener(summary);
drapEng.addActionListener(summary);
drapViet.addActionListener(summary);
}
}
}
Partager