34 lines
1000 B
Java
34 lines
1000 B
Java
|
import javax.swing.*;
|
||
|
|
||
|
import java.awt.*;
|
||
|
|
||
|
public class Puissance4_View extends JFrame {
|
||
|
public Puissance4_View() {
|
||
|
super("Puissance 4");
|
||
|
this.setLayout(new GridBagLayout());
|
||
|
Grille g = new Grille();
|
||
|
g.addMouseListener(new GrilleMouseListener(g));
|
||
|
this.setLocation(200, 200);
|
||
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||
|
GridBagConstraints gbc = new GridBagConstraints();
|
||
|
gbc.gridx = 1;
|
||
|
gbc.gridy = 1;
|
||
|
gbc.fill = GridBagConstraints.NONE;
|
||
|
gbc.anchor = GridBagConstraints.CENTER;
|
||
|
gbc.gridwidth = 1;
|
||
|
gbc.gridheight = 1;
|
||
|
gbc.weightx = 0;
|
||
|
gbc.weighty = 0;
|
||
|
gbc.insets = new Insets(0, 0, 0, 0);
|
||
|
this.add(g, gbc);
|
||
|
this.setMinimumSize(g.getMinimumSize());
|
||
|
this.pack();
|
||
|
this.setVisible(true);
|
||
|
g.requestFocusInWindow();
|
||
|
}
|
||
|
|
||
|
public static void main(String[] args) {
|
||
|
Puissance4_View v = new Puissance4_View();
|
||
|
}
|
||
|
}
|