From 2da42fcdcca7a43d71446b11e792fed23be4457a Mon Sep 17 00:00:00 2001 From: pourchot Date: Wed, 7 Jun 2023 15:43:38 +0200 Subject: [PATCH] 7 Juin --- DEV2.1/TP7:Evenements/Mainvolume.class | Bin 0 -> 649 bytes DEV2.1/TP7:Evenements/Mainvolume.java | 17 +++++++++ DEV2.1/TP7:Evenements/Volume.class | Bin 0 -> 1239 bytes DEV2.1/TP7:Evenements/Volume.java | 48 +++++++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 DEV2.1/TP7:Evenements/Mainvolume.class create mode 100644 DEV2.1/TP7:Evenements/Mainvolume.java create mode 100644 DEV2.1/TP7:Evenements/Volume.class create mode 100644 DEV2.1/TP7:Evenements/Volume.java diff --git a/DEV2.1/TP7:Evenements/Mainvolume.class b/DEV2.1/TP7:Evenements/Mainvolume.class new file mode 100644 index 0000000000000000000000000000000000000000..bdb10df6531d428b738d6b797559df17d9502353 GIT binary patch literal 649 zcmZWm+iuf95Iq|^cH@|)DKssGLJKr?;tIb&UqHMBRVs2QQmP>6(rP6NIR-iB}~U$ z$&`$*@yVp07P)wTE<_Z{T!}P2ZTjz5d+ zueRyUez;7GUYd}wddCxTvi^^@KA@q9Y(6cb4rMOqqxC*^hSa`Guc*HYn4TBm3hlNi zGK$si71(!57@CCEyoefBahq~YjbYFNo?oN#;R;504U=NE?>CKKO?)e1`G!%#_V-IH u`BsUV&K%z?QC~>6NfcP3RU=sko2X-(-0hOTE;$Rx+cP?0xI?@O*8TvKKZni$ literal 0 HcmV?d00001 diff --git a/DEV2.1/TP7:Evenements/Mainvolume.java b/DEV2.1/TP7:Evenements/Mainvolume.java new file mode 100644 index 0000000..7f9b9dd --- /dev/null +++ b/DEV2.1/TP7:Evenements/Mainvolume.java @@ -0,0 +1,17 @@ +import java.awt.*; +import javax.swing.*; +import java.awt.event.*; + +public class Mainvolume{ + public static void main(String[] args) { + + JFrame fenetre = new JFrame(); + Volume pan = new Volume(); + fenetre.setSize(1000, 150); + fenetre.setLocation(0, 0); + fenetre.addMouseWheelListener(pan); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + fenetre.setContentPane(pan); + fenetre.setVisible(true); + } +} \ No newline at end of file diff --git a/DEV2.1/TP7:Evenements/Volume.class b/DEV2.1/TP7:Evenements/Volume.class new file mode 100644 index 0000000000000000000000000000000000000000..05d3eb6087c7aeb4c6ce23b730c898bfd7f881b1 GIT binary patch literal 1239 zcmbVL+fEZv6kVscp~I9`5xj7%cqs*`;9anSfOr8h)j;q;8QLQq9cF4ft$u)Seu2gq z#RNV_4~(90FL8=js*Inh$E?^3ww1& z15xb5ew7|j=|Q!mR63}Dw2FpQG_2zgMiiRSa9G2rhB1L)$*l;8ivp1e%dxyHw^D;k z0-$gKjyLUYlw3zTotPtdTIY&@7o%xlg5EbF1aNJZ~ul ztxK+5-H;>dR0BKEVPHGj4IITWgC?EOaMHjjoHj6y2?J-4HE>oflbAAaP65*@n!#xe zvj)y9Yz`gtpusG#U2#9iRPI~Odgjtq(~-77vU$zFh0a?QPdc(Ju&r71+X}Mg%hL2H zydyRE532-Ptjc1^yjNuj&A&m9n=I3=?UFV+GnKo1Yc4mnB9QpQ;iKaus7Ox4uWaAq zX9HHFXjzxuvQ_Yk{t29Rlp7bMwO-@^TW(vnos)TnTIwQysw1+Po4PVL`wLyHnKU5O z5YXFH_qPxJz^G82re>UTJ=3#Xhs0&+zc)zo1x$cO@eegOu0h5eBiBx5X#{*sPk(?& z2j3&`hPwhgxwf$u&=G=$C|dd4h24!l5krJI@Or3@;6l2N&|~Zxev5D&k>OyF8yf#D zbwq>Np7c8eUSNW-u3!ZwlD7Zovm?cx;;O3Ee(!{fDh=Cpv_1@qmp?wM{%lV|Z*Um@ z!|_F3E8t)2IAVWu`4jS~5ga#%Rh-#syZoyl#ybe!=(^KkPm1>O^=GNex|_ z5aJsqHxc3^OH;bh)364QXqz%_lGen|bU#Cv(*FdJm)MqGVHhgVW?r$a`zd^H68iHk z=;|-@kK#0k0Q6FE9|zG-y#qXLA5|a3exxu;?c*5ccbD;1MiJUXyNJbOl+?@C0Q!Cc Dhy(%M literal 0 HcmV?d00001 diff --git a/DEV2.1/TP7:Evenements/Volume.java b/DEV2.1/TP7:Evenements/Volume.java new file mode 100644 index 0000000..837be17 --- /dev/null +++ b/DEV2.1/TP7:Evenements/Volume.java @@ -0,0 +1,48 @@ +import java.awt.*; +import javax.swing.*; +import java.awt.event.*; + +public class Volume extends JPanel implements MouseWheelListener{ + + int pos=0; + + public Volume(){ + super(); + } + + protected void paintComponent(Graphics pinceau) { + // obligatoire : on cree un nouveau pinceau pour pouvoir le modifier plus tard + Graphics pinceau2 = pinceau.create(); + if (this.isOpaque()) { + // obligatoire : on repeint toute la surface avec la couleur de fond + pinceau2.setColor(Color.DARK_GRAY); + pinceau2.fillRect(0, 0, this.getWidth(), this.getHeight()); + } for(int i=0; i0){ + if(pos==0){ + } + else{ + pos--; + this.repaint(); + } + } + if (mv<0){ + if(pos==10){ + } + else{ + pos++; + this.repaint(); + } + } + } +} \ No newline at end of file