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 79 80 81 82 83
|
class FenetreMessageFrame extends JDialog implements ActionListener
{
private DesignFenetreJDialog image;
private JLabel LAB_Texte1, LAB_Texte2;
private DesignBoutonLigne1 BOU_OK;
public FenetreMessageFrame( JFrame a, String b, boolean c, String texte1, String texte2)
{
super(a,b,c); setUndecorated(true); setSize(600, 200); setLocationRelativeTo(a);
image = new DesignFenetreJDialog("boisUnis.png", this); add(image);
image.setLayout(new BorderLayout(5,5));
image.setBorder(BorderFactory.createLineBorder(Color.black, 2));
//Titre du Dialogue
JLabel LAB_Titre = new JLabel("Informations"); LAB_Titre.setOpaque(true);
LAB_Titre.setBackground(new Color(0x3c3c3e));
LAB_Titre.setForeground(Color.white);
LAB_Titre.setFont(new Font("serif", Font.BOLD, 22));
LAB_Titre.setHorizontalAlignment(SwingConstants.CENTER);
LAB_Titre.setBorder(BorderFactory.createLineBorder(Color.black, 2));
LAB_Titre.setPreferredSize(new Dimension(
image.getWidth(),
(int) (getHeight() * 0.2)));
image.add(LAB_Titre, BorderLayout.NORTH);
//Panneau du Centre
JPanel PAN_Centre = new JPanel(); PAN_Centre.setOpaque(false);
PAN_Centre.setPreferredSize(new Dimension(
getWidth(),
(int) (getHeight() * 0.6)));
image.add(PAN_Centre, BorderLayout.CENTER);
PAN_Centre.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
//Texte1
LAB_Texte1 = new JLabel(texte1);
LAB_Texte1.setPreferredSize(new Dimension(
PAN_Centre.getPreferredSize().width,
(int) (PAN_Centre.getPreferredSize().height * 0.2)));
LAB_Texte1.setForeground(new Color(0xab3005));
LAB_Texte1.setFont(new Font("Serif",Font.BOLD,19));
LAB_Texte1.setHorizontalAlignment(SwingConstants.CENTER);
PAN_Centre.add(LAB_Texte1);
//Texte2
LAB_Texte2 = new JLabel(texte2);
LAB_Texte2.setPreferredSize(new Dimension(
PAN_Centre.getPreferredSize().width,
(int) (PAN_Centre.getPreferredSize().height * 0.2)));
LAB_Texte2.setFont(new Font("Serif",Font.BOLD,19));
LAB_Texte2.setHorizontalAlignment(SwingConstants.CENTER);
PAN_Centre.add(LAB_Texte2);
//Validation
BOU_OK = new DesignBoutonLigne1("frene.png",
(int) (PAN_Centre.getPreferredSize().width * 0.37),
(int) (PAN_Centre.getPreferredSize().height * 0.35),
"OK");
BOU_OK.setPreferredSize(new Dimension(
(int) (PAN_Centre.getPreferredSize().width * 0.37),
(int) (PAN_Centre.getPreferredSize().height * 0.35)));
BOU_OK.addActionListener(this);
PAN_Centre.add(BOU_OK);
//Panneau en bas
JPanel PAN_Sud = new JPanel(); PAN_Sud.setOpaque(true);
PAN_Sud.setBackground(new Color(0x3c3c3e));
PAN_Sud.setBorder(BorderFactory.createLineBorder(Color.black, 2));
PAN_Sud.setPreferredSize(new Dimension(
image.getWidth(),
(int) (getHeight() * 0.2)));
image.add(PAN_Sud, BorderLayout.SOUTH);
this.setVisible(true);
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
Logger.getLogger(FenetreMessageFrame.class.getName()).log(Level.SEVERE, null, ex);
}
this.setVisible(false);
}
public void actionPerformed(ActionEvent e) { setVisible(false); }
} |
Partager