2022-04-21 22:17:57 +02:00
|
|
|
import java.awt.*;
|
|
|
|
import javax.swing.*;
|
|
|
|
|
|
|
|
public class nombreCollonnesLigneEtBombe{
|
|
|
|
private int collonne, ligne, bombe, max, min;
|
|
|
|
JFrame fenetre;
|
|
|
|
public nombreCollonnesLigneEtBombe(JFrame fenetre0){
|
|
|
|
this.min=4;
|
|
|
|
// il y a au minimun 4 ligne et 4 collonnes
|
|
|
|
this.max=30;
|
|
|
|
// il y a 30 ligne et collonne au max
|
|
|
|
this.collonne=1;
|
|
|
|
this.ligne=3;
|
|
|
|
this.bombe=0;
|
|
|
|
this.fenetre=fenetre0;
|
2022-04-26 16:43:29 +02:00
|
|
|
this.Choix();
|
2022-04-21 22:17:57 +02:00
|
|
|
}
|
|
|
|
public void setCollonne(int n){
|
|
|
|
this.collonne=n;
|
|
|
|
if(this.collonne<this.min){
|
|
|
|
this.collonne=this.min;
|
|
|
|
}
|
|
|
|
if(this.collonne>this.max){
|
|
|
|
this.collonne=this.max;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void setLigne(int n){
|
|
|
|
this.ligne=n;
|
|
|
|
if(this.ligne<this.min){
|
|
|
|
this.ligne=this.min;
|
|
|
|
}
|
|
|
|
if(this.ligne>this.max){
|
|
|
|
this.ligne=this.max;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void setBombe(int n){
|
|
|
|
this.bombe=n;
|
|
|
|
if(this.bombe<this.min){
|
|
|
|
this.bombe=this.min;
|
|
|
|
}
|
|
|
|
if(this.bombe>this.max){
|
|
|
|
this.bombe=this.max;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public int getMax(){
|
|
|
|
return this.max;
|
|
|
|
}
|
|
|
|
public int getMin(){
|
|
|
|
return this.min;
|
|
|
|
}
|
|
|
|
public int getLignes(){
|
|
|
|
return this.ligne;
|
|
|
|
}
|
|
|
|
public int getCollonnes(){
|
|
|
|
return this.collonne;
|
|
|
|
}
|
|
|
|
public JFrame getJFrame(){
|
|
|
|
JFrame fen2 = new JFrame();
|
|
|
|
GridLayout grille = new GridLayout(this.ligne, this.collonne, 5, 5);
|
|
|
|
fen2.setLayout(grille);
|
|
|
|
fen2.setSize(1000,800);
|
|
|
|
fen2.setLocation(0,0);
|
|
|
|
fen2.setVisible(true);
|
2022-04-26 16:43:29 +02:00
|
|
|
fen2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
2022-04-21 22:17:57 +02:00
|
|
|
return fen2;
|
|
|
|
}
|
2022-04-26 16:43:29 +02:00
|
|
|
private void Choix(){
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2022-04-21 22:17:57 +02:00
|
|
|
}
|