From 67f674b6efbf0d92dfa51645afa89f6e73fa556e Mon Sep 17 00:00:00 2001 From: HORVILLE Ewen Date: Tue, 22 Mar 2022 16:56:37 +0100 Subject: [PATCH] TP10 fin --- APL2.1/TP10/Combinaison/Combinaison.class | Bin 0 -> 913 bytes APL2.1/TP10/Combinaison/Combinaison.java | 37 ++++++++++++------ APL2.1/TP10/Combinaison/Observer.class | Bin 892 -> 1188 bytes APL2.1/TP10/Commande/Commande.class | Bin 0 -> 926 bytes APL2.1/TP10/Commande/Commande.java | 45 ++++++++++++++++++++++ APL2.1/TP10/Commande/Observer.class | Bin 0 -> 1036 bytes 6 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 APL2.1/TP10/Combinaison/Combinaison.class create mode 100644 APL2.1/TP10/Commande/Commande.class create mode 100644 APL2.1/TP10/Commande/Commande.java create mode 100644 APL2.1/TP10/Commande/Observer.class diff --git a/APL2.1/TP10/Combinaison/Combinaison.class b/APL2.1/TP10/Combinaison/Combinaison.class new file mode 100644 index 0000000000000000000000000000000000000000..0f302c6ed294d0f1b5aa91084642b0822fdd9536 GIT binary patch literal 913 zcmZuvT~8B16g|`Kc9*3}sesfk1V7lelm$`1@{wo_38a7#f&rhV?MRliySTdr@y!?g zJ-)PwO?)=~4gZJn-qHjxHqE(bX3w2_?#%u5=lc%;3s|u*f-wX4O^jQJVS?cS!$XEg z1|C~5SuttCwqRkxMAk%(Y2Lt;g%rkET3|*H!?Xd%z>Gj*+4bCLRUmF>_XM<(UsD1D zW!F<%%|=B9yRuTJ9jzfc{EKlMlMg`K$KRV$lWjPybfo$-}Yra=w!E6#wFqgzrhG&=;Ft;nA3QklYFnT5R zjjXx;%Vre$oPa{X2P#exwMfa}blqit9B&8;feUIcz*>ks?f3Zo=LvHrm z&^>=k`yjiAaSYR3@h=9!??afO)m@5$qMmC*d?O-oi!jmMoJ1dP;|_6_{ze=I#jhR2 z_S5k;v~qqBKk46so=??MwH6ZjL<>d-=6)M}n;lsD>Hap7TU~aISW)ZJ>rC~+R0{(c zt&2Ki2PsM%EGF_9Iw$=$lPI)sgF;5@MV(`wRznwNH;^V2#BQ=>J^lm(h3Gbfrv4Iw<#U#V!KPWThIr8h<^Z{ zO|&GM7@qx2Mm@9TYD|-F=IptB=R4D%zrXzeFoPEc+AtPI9Cs8X6^wJF3 zFeVjDabye_xXW=*o%cg{5W>R{9vPH0%`wCAnBxfpufBC^<>C$l+r6}Mm$y7aaNe>l zZ;?Suj=yHmb52n*#MUiaZqzCT>An($GJT2E4vNB)Ij8Kn44ujKeQ_w>XR1e*UCOL& z30s!uRDtGgPwc(Ri-YsLnAr0y$KI0e8^^84BEw)KHzSU`j69UKms#>dmerkVaLjVd zF&NuU&E1nLmTKRUb1DVP7FN}=RW%^ClLsXyPfJ znOH)Wq3Z_qm!fDn*_!7$wuu~`GsJKB{n1P;V}&8GCTcdZ;dxOavO?+gK~P>l1{gw{ zg{pK9CF#@R^C%0_X0xy__dJIFOKR7LUbm{Av{g#afBn8FH|lMBE=f*{ORlc2`ifVj zmnF?hu2Zu~-?nS|`YQN)X(>ssp))C25h}1fIqq*U)OQ-z0NjJRcQ3&X?289+w)IaAe|cdX|sgA zWX+?AZa{nL6fC8EMUw(ef&Q7kGxQNA=r00NZ95ED)1HifBbJ zl4ZXTVHZdwhH&eg$}yD)QdoYXj*x=z8H|m|IwEHn3GmLE{UFv_wWC+dohD|E_EcMCv_t^0BHu9jSNihD1)l zsdvu0Cym`!yTRsAy>E3EKd8^jMH~rE+9vcBd;~9q&{s2X6&pmHVSjzi2F6nC0VAO|K~J?bMD+NFvG`QO$!HL}q7w$Zm!x zh{5zV#1DQ19A)z-K!;NX~1j2N85#bwU;0Xp!F>H=;*SUX-%3V$# XQyD|x4k?Kz5~hR|i!kBX(Cz7e)+$*n diff --git a/APL2.1/TP10/Commande/Commande.class b/APL2.1/TP10/Commande/Commande.class new file mode 100644 index 0000000000000000000000000000000000000000..66cd30dc9611e523678535807cacd0146e7e990b GIT binary patch literal 926 zcmZuw+fLg+5IvhXaWJ7tC{SEzA(V>~6HJEF6Dd3}5W^(H6vH&bj1J2{ ziWvn12J#HFV=%`+QHO0H!{H1^GQ5|;ET@*(BZy&6M_I>1f#kC5x#25;xK-E|&{lj$ z31q6Sr`FrenhLgLtw9m3DP2!s$ogD8kVmrIklucIGYnjBe~A-~O}`z~RmEj;--_RC zO3zVq%uU0@U4ee~Ps*)hN-2M+1hUCxE57G2VLpvVc$~%)hNpNYklLuVRB)sM>Utw} zOPz!jS2ZYa0nh&}{84(Uk;V%wrm=+OG+u(HOI;}v$X@H;s2!+!C@^UKe<;1B!cF&# zbSA9TRUWgKB2~XGL)WLTF-)s>YEQNs;Y!1Asf|MwTyAMrm!Ff4^R~|Hs@n>c$J0z) zc9X|pSsf`aEZ<~wzh@6OlBa%~xP0>!^LH0z=7QQ@V+#a!I! zI!K2_#kbv-dvUVXr@}V!xI?#&pBMxm7~u%5?vWK_6UB3gujB}f5+=LBLG%#eKKV@j zg*Xyq&pL?h_Q%hmRqY&p&>JCPXPvAQA!#Qg=pCeX&(X8ifkC!+y%di}NSBD29f;6Z znvHO)gADCu7d2D6Dv~obCia_}h;Z9BwFm<{rdEnDxMR~|=vrR|IZ`rA|AUDE8fKIf u=1FS-W0=P{U7S4LU;^(kiFHh27t{EH8SD|Gi6TPSIK?bYHb!+~82k7 literal 0 HcmV?d00001 diff --git a/APL2.1/TP10/Commande/Commande.java b/APL2.1/TP10/Commande/Commande.java new file mode 100644 index 0000000..d7aadb2 --- /dev/null +++ b/APL2.1/TP10/Commande/Commande.java @@ -0,0 +1,45 @@ +import java.awt.*; +import javax.swing.*; +import java.awt.event.*; + +class Observer implements ActionListener { + public Observer() {} + + public void actionPerformed(ActionEvent evt) { + String input = evt.getActionCommand().toLowerCase().trim(); + JTextField textField = (JTextField)evt.getSource(); + JPanel panel = (JPanel)textField.getParent(); + + if (input.equals("cyan")) panel.setBackground(Color.CYAN); + else if (input.equals("jaune")) panel.setBackground(Color.YELLOW); + else if (input.equals("magenta")) panel.setBackground(Color.MAGENTA); + + textField.setText(""); + } +} + +public class Commande { + + public static void main(String[] args) { + JFrame f = new JFrame("Fond"); + f.setSize(200, 200); + f.setLocation(100, 100); + f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + Observer observer = new Observer(); + + JTextField t = new JTextField(); + t.setLocation(0, 0); + t.setSize(200, 20); + t.addActionListener(observer); + + JPanel p = new JPanel(); + p.setSize(200, 200); + p.setLocation(0, 0); + p.setLayout(null); + + f.add(p); + p.add(t); + f.setVisible(true); + } +} \ No newline at end of file diff --git a/APL2.1/TP10/Commande/Observer.class b/APL2.1/TP10/Commande/Observer.class new file mode 100644 index 0000000000000000000000000000000000000000..efb84de6b6e895456eb041508e8cef4686aa06df GIT binary patch literal 1036 zcmZuwTT|0O6#f?4Bu&#&0-~T5#9Ir6;uWQMDYc*&3Ns)M>dUrWJHa;5GzI)A{sDc~ zhdASd!?Qn%@ob8M9beAwetXWh-?{9sqaQy3%)`<#j0qi=FsUPr%hFtt$Ezx?=}>T8 zMMgtb;!`n9Bd0^djD}fx$ZMFB>kSPzrSmNnw^iIxahE|^v>n@j$k3n3ZZkwmZe1`8 zShgc7omN$NTfEwo2(S6J>ud<`t?RW!onbsQ^yz#}|nF#oyT;ErfgF13%`F;K*kijsjRC>vPD3PW_4cN}5hDas6L zi#JFxJ^xG|VPF-{8MO6kTX=iIV@QQ*HaR`KUfmTnpCKJWy_s8f+ZRqx$foa+WQMW- zhJ?kUCmO=yH+a+@yICQ{ldR!INJD1;Zp zm1qlpiQ3=r+>S%zGIVNOx;}D5l%29=t-qu;tQA+vm8~M}C{XsdN5ydkvfG%z5d8+a zrmxXQD~%1=b9746N-acm>O0t1+AxfgRYFkOF`OqWT|ZN3l-4)X0r~>;2Z*fEHhKu9 zG7~^OgtidLnXv%+CnQHB-w+RAd_g8>CQh(qhz;k=fe?#JzZ79J=3oF*D(DLpOww-z sVu(X0@o`*00&_^xOb*}$2JspuVL%G~N0?KQR-vfShEk;VV#qT78;|_!TmS$7 literal 0 HcmV?d00001