wow le tp là
This commit is contained in:
43
DEV3.1/TP01/02_Victoire/Fenetre.java
Normal file
43
DEV3.1/TP01/02_Victoire/Fenetre.java
Normal file
@@ -0,0 +1,43 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Fenetre extends JFrame {
|
||||
|
||||
private String nomPays;
|
||||
private int scorePays;
|
||||
|
||||
public Fenetre(String nomPays, int scorePays) {
|
||||
this.nomPays = nomPays;
|
||||
this.scorePays = scorePays;
|
||||
|
||||
this.setSize(200, 200);
|
||||
this.setLocation(100, 100);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
this.setLayout(new BorderLayout());
|
||||
|
||||
JLabel pays = new JLabel(this.nomPays);
|
||||
JLabel score = new JLabel(this.scorePays + "");
|
||||
JPanel south = new JPanel();
|
||||
JButton refresh = new JButton("↻");
|
||||
|
||||
refresh.addActionListener(new Rafraichir(score, pays, this));
|
||||
|
||||
Font policeScore = new Font("Arial", Font.BOLD, 60);
|
||||
Font policePays = new Font("Arial", Font.BOLD, 40);
|
||||
|
||||
score.setFont(policeScore);
|
||||
pays.setFont(policePays);
|
||||
|
||||
pays.setHorizontalAlignment(JLabel.CENTER);
|
||||
score.setHorizontalAlignment(JLabel.CENTER);
|
||||
refresh.setHorizontalAlignment(JButton.RIGHT);
|
||||
|
||||
|
||||
this.add(pays, BorderLayout.NORTH);
|
||||
this.add(score, BorderLayout.CENTER);
|
||||
this.add(south, BorderLayout.SOUTH);
|
||||
south.setLayout(new BorderLayout());
|
||||
south.add(refresh, BorderLayout.EAST);
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user