From d6eee1976146a6488f7349592eef523418fc0855 Mon Sep 17 00:00:00 2001 From: martins Date: Wed, 27 Apr 2022 13:19:57 +0200 Subject: [PATCH] ok --- CASE/Case.class | Bin 0 -> 1644 bytes CASE/Case.java | 75 +++++++++++++++++++++++++++++++++++++ CASE/main_ex.class | Bin 0 -> 1041 bytes CASE/main_ex.java | 31 +++++++++++++++ CASE/observateurCase.class | Bin 0 -> 899 bytes CASE/observateurCase.java | 43 +++++++++++++++++++++ 6 files changed, 149 insertions(+) create mode 100644 CASE/Case.class create mode 100644 CASE/Case.java create mode 100644 CASE/main_ex.class create mode 100644 CASE/main_ex.java create mode 100644 CASE/observateurCase.class create mode 100644 CASE/observateurCase.java diff --git a/CASE/Case.class b/CASE/Case.class new file mode 100644 index 0000000000000000000000000000000000000000..5cb8bf3402ff3f14f15374bf2e18b3d779fa9ca0 GIT binary patch literal 1644 zcmb7EOK%%h6#lL~Y*v6hR^%#4c zz=BN|ELgFnl~C0M5@LlYsYDBF#NXg2up@}_ow4IazycEc+;h(T&bi+?=lcHg=MO&t zIEys{12`E)0x1z`5g8HV2C~Q*)Fwpa#XKe2X%T0{oDAcvfnJ=8;8n5Di?|TRYhg?& z7~6K!-m)FrD=VlQ3i_6NXN!7h+vQG;&SiyYv(>EIp6${O&Db^Dn^g#=(whoe!7UNq zzhc+QYb}O0-m?uiB0aT}749Z-`duHkhPD_E7H zc^v5p^rL)p$F5cK*ADQGcXRBsX5Wg9vL#&}Or`&&DmKP$uGg&(TZFK+97S)1onnJ3 z4YyS*DI^XC`sCOKX{WC%3>@fId)x0fv%GDWysDp8hDpa#*{)RC;K=*7DVT z9@GLd5`X1X{FQ^@szb@xC|{s8Pn_bK%sht51iwc>L{Nk#LjRVV3NKO~Mu@VHNAx3# z7_~T$OfcyH5ij9LC*>GZ28ax0Mw#w;yy1HXNnnV`m%9`MFBC!JlDYl}y7nGPW~hW7Akt+V@EIq_6^t`jYJ#3&ay&{8QEJqrfgQ7lON5`)=9zwpz2db+cVm^774 z9=0pKA9-r5@jIpE{C4QhdQS5zGMrenx}MYbjWCT+#|Tjmcl7n7CXqcc!_liWB)W%b zlA45yI~EbY#6GtqT2Niuu}?bH=8_u66PF9q9`~pIaF214Ct%_ve+MbfID<6CF~x^? z2|3)t1n%M#KEr9;#~FN$N&LuH|5u#DZ#a+NaY31UtVj9m9l?w`j*BXXSv7@AY7v*! z2Ck@gFsE*#pgdevcQLO%$AY?tMfDAzwD0(G$rVdL{{v%T9N)vcd#I1>;Va&?6F%2h F{sKbuIG+Fj literal 0 HcmV?d00001 diff --git a/CASE/Case.java b/CASE/Case.java new file mode 100644 index 0000000..c32b5af --- /dev/null +++ b/CASE/Case.java @@ -0,0 +1,75 @@ +// Tom Monin et Clément Martins +// paintChoix V1 +// class pour l'affichage de la selection des lignes, collonnes et nombre de mines + +import java.awt.*; +import javax.swing.*; +import javax.swing.JComponent; + +public class Case extends JComponent{ + private boolean visibilite; + private boolean bombe; + private int voisin; + private int suspition; + public Case(){ + this.visibilite=false; + this.bombe=false; + this.voisin=0; + this.suspition=0; + } + public void setVisibiliter(boolean trueorfalse){ + this.visibilite=trueorfalse; + } + public void setBombe(){ + this.bombe=true; + } + public void suspition(){ + this.suspition++; + if(this.suspition==3){ + this.suspition=0; + } + } + @Override + protected void paintComponent(Graphics pinceau) { + // obligatoire : on crée un nouveau pinceau pour pouvoir le modifier plus tard + Graphics secondPinceau = pinceau.create(); + // obligatoire : si le composant n'est pas censé être transparent + if (this.isOpaque()) { + // obligatoire : on repeint toute la surface avec la couleur de fond + secondPinceau.setColor(this.getBackground()); + secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); + } + if(this.visibilite==false){ + secondPinceau.setColor(new Color(100,100,100)); + secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); + secondPinceau.setColor(new Color(200, 200, 200)); + secondPinceau.fillRect(this.getWidth()/20, this.getHeight()/20, this.getWidth()/20*18, this.getHeight()/20*18); + } + if(this.visibilite==true){ + secondPinceau.setColor(new Color(100,100,100)); + secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); + secondPinceau.setColor(new Color(255, 255, 255)); + secondPinceau.fillRect(this.getWidth()/20, this.getHeight()/20, this.getWidth()/20*18, this.getHeight()/20*18); + secondPinceau.setColor(new Color(255,0,0)); + } + if(this.voisin>0){ + secondPinceau.drawString("3", this.getWidth()/2, this.getHeight()/2); + } + if(this.suspition==1 && this.visibilite==false){ + int[] x = new int[5]; + int[] y = new int[5]; + x[0]=this.getWidth()/2; + x[1]=this.getWidth()/10*9; + x[2]=this.getWidth()/10*7; + x[3]=this.getWidth()/10*3; + x[4]=this.getWidth()/10; + y[0]=this.getHeight()/10*2; + y[1]=this.getHeight()/2; + y[2]=this.getHeight()/10*8; + y[3]=this.getHeight()/10*8; + y[4]=this.getHeight()/2; + secondPinceau.setColor(new Color(255,0,125)); + secondPinceau.fillPolygon(x, y, 5); + } + } +} \ No newline at end of file diff --git a/CASE/main_ex.class b/CASE/main_ex.class new file mode 100644 index 0000000000000000000000000000000000000000..1dfb45b2cfc9cc45e9a9065ba8897a4395e347d3 GIT binary patch literal 1041 zcmZuw&rcIU6#k~&?Y3osEm%Yl1%F_nKoJqtA_yfYW($cm804S>9m!(5OSW5nc*c__ z{S&wtkH(};Y~qD@@lPT~e6y_q6ZY`ty>GsG?|pA)e*O9W1Hd@uqqu-R4cEfB9z_5* zq`4_gzlK{;Xh_IlK$<~mk{X6I3`fx{kBvmpij)jS<>qY-V;b%-gr+Rp@}?PriGdXc zCFA4;L#t`oVyRqQ7w&VuULZs%a?57uNUWJ#e21qB+}=#(JlC=})AC?*&f^#mLoOzOCYNrra6KHv3Hk6kNo@_nc5NfPbf#{(T{OzC(Ck`!KBGc&v-(oz?#q{~?^ z33rEklvpD2+>DM#nAI_d41?Bakij^WxxBt5Hax0)j&_E4;{1s;m4s(H8{D%T8l0L~ zT$FRt2+djVq(r&zchAt>$RSnLu`IXwrf~h)b`o=5yy4}7mnk?UvAiwZMp`A|XN?kL z#VT3#UzK<%E5#CZ@&AS(F@xvxS*KhQrd9HUEnJ4aGo{6ju)WlO1iyhG9b*_g!^}9v zZO0~ddZ4aec76(?5AAeaoBXsbqx5w0SfO%7EMNrozjCY1`BB>WS4U@17E z#1*6E5N2>fjjKlZ5L3f(Wh}1N(7akjORgS`)zG@yaEGffDu^W;VFhh34pjE}(T(>Me<1uLu22N@ hLOH=KR1KFk^k}%EL8meOMuZ(>=9nhIaMiEc`xhN3-t_i)Cc80!t%5mfHg9L62T`1RU)T$I?#(GKYs(WcsNJlzt{qYRsvttLA}#-3yPT zKw+Q)`6@XZ%IGai2zX~<63gCLjZWo}K&>%2@uz;*|Dd~aDg)i!<@-Lr?yyj9U;Cre zU4QaNeLv7L;`(JH*Z-(AM|1Jlk&I&wbLR4mBgS2pVPKe-yjF55kdLK4P_Y`SF%3@ncHz%nD!;l`O+9)1ZItH%YJ@9`)9RE~U7WT-X{(FVnv{0SI9mG& D7ILEL literal 0 HcmV?d00001 diff --git a/CASE/observateurCase.java b/CASE/observateurCase.java new file mode 100644 index 0000000..af4e9b5 --- /dev/null +++ b/CASE/observateurCase.java @@ -0,0 +1,43 @@ +//Tom Monin et Clément Martins +// observateurChoix V1 +//Class pour la selection du nombre de collone et ligne et de Mine a la souris +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +public class observateurCase implements MouseListener{ + private Case case1; + private Case[][] tableau; + public observateurCase(Case case10, Case[][] tableau0){ + // pour savoir si c'est l'observateur de la fleche de gauche ou droite + this.case1=case10; + this.tableau=tableau0; + } + @Override + public void mouseClicked(MouseEvent evenement){ + if(evenement.getButton() == MouseEvent.BUTTON1){ + case1.setVisibiliter(true); + case1.repaint(); + } + if(evenement.getButton() == MouseEvent.BUTTON3){ + case1.suspition(); + case1.repaint(); + } + } + @Override // un bouton cliqué + public void mouseEntered(MouseEvent evenement){ + + } + @Override // debut du survol + public void mouseExited(MouseEvent evenement){ + } + @Override // fin du survol + public void mousePressed(MouseEvent evenement){ + + } + @Override // un bouton appuyé + public void mouseReleased(MouseEvent evenement){ + + } + +} \ No newline at end of file