grille 1
This commit is contained in:
parent
a5d270a9a1
commit
b2b151a303
@ -1,6 +1,7 @@
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import javax.swing.border.LineBorder;
|
||||||
|
|
||||||
public class grille extends JComponent{
|
public class grille extends JComponent{
|
||||||
|
|
||||||
@ -12,10 +13,11 @@ public class grille extends JComponent{
|
|||||||
/*paramètre de base de la fenetre*/
|
/*paramètre de base de la fenetre*/
|
||||||
JFrame fenetre = new JFrame();
|
JFrame fenetre = new JFrame();
|
||||||
fenetre.setSize(900, 900);
|
fenetre.setSize(900, 900);
|
||||||
|
fenetre.setResizable(false);
|
||||||
fenetre.setLocationRelativeTo(null);
|
fenetre.setLocationRelativeTo(null);
|
||||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
/*creation grille*/
|
/*creation grille*/
|
||||||
GridLayout gestionnaire = new GridLayout(9, 9);
|
GridLayout gestionnaire = new GridLayout(9,9,-2,-2);
|
||||||
fenetre.setLayout(gestionnaire);
|
fenetre.setLayout(gestionnaire);
|
||||||
|
|
||||||
|
|
||||||
@ -29,11 +31,13 @@ public class grille extends JComponent{
|
|||||||
for (int j = 0; j < 9; j++) {
|
for (int j = 0; j < 9; j++) {
|
||||||
if ((grid_values[i][j]) == 0) {
|
if ((grid_values[i][j]) == 0) {
|
||||||
case_modifiable[i][j] = new JTextField("", 1);
|
case_modifiable[i][j] = new JTextField("", 1);
|
||||||
|
case_modifiable[i][j].setBorder(new LineBorder(Color.BLACK, 5));
|
||||||
case_modifiable[i][j].setFont(new Font("Arial", Font.PLAIN, 30));
|
case_modifiable[i][j].setFont(new Font("Arial", Font.PLAIN, 30));
|
||||||
case_modifiable[i][j].setHorizontalAlignment(JTextField.CENTER);
|
case_modifiable[i][j].setHorizontalAlignment(JTextField.CENTER);
|
||||||
fenetre.add(case_modifiable[i][j]);
|
fenetre.add(case_modifiable[i][j]);
|
||||||
} else {
|
} else {
|
||||||
case_depart[i][j] = new JLabel(String.valueOf(grid_values[i][j]));
|
case_depart[i][j] = new JLabel(String.valueOf(grid_values[i][j]));
|
||||||
|
case_depart[i][j].setBorder(new LineBorder(Color.BLACK, 5));
|
||||||
case_depart[i][j].setFont(new Font("Arial", Font.PLAIN, 30));
|
case_depart[i][j].setFont(new Font("Arial", Font.PLAIN, 30));
|
||||||
case_depart[i][j].setHorizontalAlignment(JTextField.CENTER);
|
case_depart[i][j].setHorizontalAlignment(JTextField.CENTER);
|
||||||
fenetre.add(case_depart[i][j]);
|
fenetre.add(case_depart[i][j]);
|
||||||
|
Loading…
Reference in New Issue
Block a user