From cf33623a5d10e549aea829320902cacaff6e7793 Mon Sep 17 00:00:00 2001 From: Simoes Lukas Date: Wed, 12 Mar 2025 17:10:44 +0100 Subject: [PATCH] TP Exceptions --- DEV2.1/TP09/02_Playlist/Fenetre.class | Bin 1223 -> 1629 bytes DEV2.1/TP09/02_Playlist/Fenetre.java | 58 +++++++++++++----- DEV2.1/TP09/02_Playlist/GestionSouris.class | Bin 896 -> 1447 bytes DEV2.1/TP09/02_Playlist/GestionSouris.java | 37 +++++++++-- DEV2.1/TP09/02_Playlist/JLabel2.class | Bin 0 -> 450 bytes DEV2.1/TP09/02_Playlist/JLabel2.java | 19 ++++++ DEV2.1/TP09/03_Rectangle/Fenetre.class | Bin 0 -> 618 bytes DEV2.1/TP09/03_Rectangle/Fenetre.java | 13 ++++ .../03_Rectangle/GestionMouvementSouris.class | Bin 0 -> 904 bytes .../03_Rectangle/GestionMouvementSouris.java | 24 ++++++++ DEV2.1/TP09/03_Rectangle/GestionSouris.class | Bin 0 -> 1982 bytes DEV2.1/TP09/03_Rectangle/GestionSouris.java | 57 +++++++++++++++++ DEV2.1/TP09/03_Rectangle/Main.class | Bin 0 -> 322 bytes DEV2.1/TP09/03_Rectangle/Main.java | 6 ++ DEV2.1/TP09/03_Rectangle/Rectangle.class | Bin 0 -> 874 bytes DEV2.1/TP09/03_Rectangle/Rectangle.java | 29 +++++++++ .../ArithmeticExceptionApplication.class | Bin 0 -> 433 bytes .../ArithmeticExceptionApplication.java | 5 ++ ...IndexOutOfBoundsExceptionApplication.class | Bin 0 -> 485 bytes ...yIndexOutOfBoundsExceptionApplication.java | 6 ++ .../NullPointerExceptionApplication.class | Bin 0 -> 348 bytes .../NullPointerExceptionApplication.java | 9 +++ .../NumberFormatExceptionApplication.class | Bin 0 -> 406 bytes .../NumberFormatExceptionApplication.java | 6 ++ .../RunTimeExceptionApplication.class | Bin 0 -> 383 bytes .../RunTimeExceptionApplication.java | 5 ++ .../ArithmeticExceptionApplication.class | Bin 0 -> 643 bytes .../ArithmeticExceptionApplication.java | 16 +++++ DEV2.1/TP10/03_Incomplet/Incomplet.class | Bin 0 -> 551 bytes DEV2.1/TP10/03_Incomplet/Incomplet.java | 11 ++++ DEV2.1/TP10/04_Apparences/Fond$1.class | Bin 0 -> 685 bytes DEV2.1/TP10/04_Apparences/Fond$2.class | Bin 0 -> 688 bytes DEV2.1/TP10/04_Apparences/Fond$3.class | Bin 0 -> 687 bytes DEV2.1/TP10/04_Apparences/Fond.class | Bin 0 -> 1707 bytes DEV2.1/TP10/04_Apparences/Fond.java | 58 ++++++++++++++++++ DEV2.1/TP10/05_Degres/Conversion.class | Bin 0 -> 374 bytes DEV2.1/TP10/05_Degres/Conversion.java | 9 +++ DEV2.1/TP10/05_Degres/Degres.class | Bin 0 -> 1365 bytes DEV2.1/TP10/05_Degres/Degres.java | 38 ++++++++++++ DEV2.1/TP10/05_Degres/Fenetre.class | Bin 0 -> 529 bytes DEV2.1/TP10/05_Degres/Fenetre.java | 13 ++++ DEV2.1/TP10/05_Degres/GestionJTextField.class | Bin 0 -> 1814 bytes DEV2.1/TP10/05_Degres/GestionJTextField.java | 46 ++++++++++++++ DEV2.1/TP10/05_Degres/Main.class | Bin 0 -> 322 bytes DEV2.1/TP10/05_Degres/Main.java | 6 ++ 45 files changed, 448 insertions(+), 23 deletions(-) create mode 100644 DEV2.1/TP09/02_Playlist/JLabel2.class create mode 100644 DEV2.1/TP09/02_Playlist/JLabel2.java create mode 100644 DEV2.1/TP09/03_Rectangle/Fenetre.class create mode 100644 DEV2.1/TP09/03_Rectangle/Fenetre.java create mode 100644 DEV2.1/TP09/03_Rectangle/GestionMouvementSouris.class create mode 100644 DEV2.1/TP09/03_Rectangle/GestionMouvementSouris.java create mode 100644 DEV2.1/TP09/03_Rectangle/GestionSouris.class create mode 100644 DEV2.1/TP09/03_Rectangle/GestionSouris.java create mode 100644 DEV2.1/TP09/03_Rectangle/Main.class create mode 100644 DEV2.1/TP09/03_Rectangle/Main.java create mode 100644 DEV2.1/TP09/03_Rectangle/Rectangle.class create mode 100644 DEV2.1/TP09/03_Rectangle/Rectangle.java create mode 100644 DEV2.1/TP10/01_Plantages/ArithmeticExceptionApplication.class create mode 100644 DEV2.1/TP10/01_Plantages/ArithmeticExceptionApplication.java create mode 100644 DEV2.1/TP10/01_Plantages/ArrayIndexOutOfBoundsExceptionApplication.class create mode 100644 DEV2.1/TP10/01_Plantages/ArrayIndexOutOfBoundsExceptionApplication.java create mode 100644 DEV2.1/TP10/01_Plantages/NullPointerExceptionApplication.class create mode 100644 DEV2.1/TP10/01_Plantages/NullPointerExceptionApplication.java create mode 100644 DEV2.1/TP10/01_Plantages/NumberFormatExceptionApplication.class create mode 100644 DEV2.1/TP10/01_Plantages/NumberFormatExceptionApplication.java create mode 100644 DEV2.1/TP10/01_Plantages/RunTimeExceptionApplication.class create mode 100644 DEV2.1/TP10/01_Plantages/RunTimeExceptionApplication.java create mode 100644 DEV2.1/TP10/02_Capture/ArithmeticExceptionApplication.class create mode 100644 DEV2.1/TP10/02_Capture/ArithmeticExceptionApplication.java create mode 100644 DEV2.1/TP10/03_Incomplet/Incomplet.class create mode 100644 DEV2.1/TP10/03_Incomplet/Incomplet.java create mode 100644 DEV2.1/TP10/04_Apparences/Fond$1.class create mode 100644 DEV2.1/TP10/04_Apparences/Fond$2.class create mode 100644 DEV2.1/TP10/04_Apparences/Fond$3.class create mode 100644 DEV2.1/TP10/04_Apparences/Fond.class create mode 100644 DEV2.1/TP10/04_Apparences/Fond.java create mode 100644 DEV2.1/TP10/05_Degres/Conversion.class create mode 100644 DEV2.1/TP10/05_Degres/Conversion.java create mode 100644 DEV2.1/TP10/05_Degres/Degres.class create mode 100644 DEV2.1/TP10/05_Degres/Degres.java create mode 100644 DEV2.1/TP10/05_Degres/Fenetre.class create mode 100644 DEV2.1/TP10/05_Degres/Fenetre.java create mode 100644 DEV2.1/TP10/05_Degres/GestionJTextField.class create mode 100644 DEV2.1/TP10/05_Degres/GestionJTextField.java create mode 100644 DEV2.1/TP10/05_Degres/Main.class create mode 100644 DEV2.1/TP10/05_Degres/Main.java diff --git a/DEV2.1/TP09/02_Playlist/Fenetre.class b/DEV2.1/TP09/02_Playlist/Fenetre.class index 0125b32a24d4935b59d28d27155b785e3212857f..5d51810d211553ddda1d89c7e0e334641030a5de 100644 GIT binary patch literal 1629 zcmX^0Z`VEs1_mdFR4xW424;2!79Ivx1~x_pp{&HR#0vf5^31$+eJ{77#N1Ry1~!|_ zyv!0iMh0dL%`i>|4hBwk1}+{3ZU!Dk26ng9ywsASR7M7l)Z!AynM0~FlaL}aCoFvDtIO4rE)OnGBWUZDtKq+m2umzW7CTCZ2Fc>p32!$kOr-D=#DflK9XDj%prExHrGBR+4 zW#pHpXOt*-DugE%E4ZX4rf@J=GBR-ZWM-!-cx2{sFjzA(usbE@ zlhYK|HtbL%Vz#0^@vJ5Uf46Y1rj0^&aDJj1BrNyZ}nZ+fkd8tK=42sae z1jS@(S!!O1K8gaU0UkUIo(x`$45G!UB~bhG5;KcZA&y{V5Yq603PVJ|+Bg_|co=*c z{1_RS6H`(c8MKhBa?Z~!$j?j7E3wu@qzHr{DE$QRFa(0K082q)ayBTH2lFt5FoZHP zuqHxMHKz~EyNnDh&iN^+j12rfnR%&xrMXF|MInhvIjM{cyul@j$=SY%1zGfq{vE3FIj-i<^Omfq{XQff1DT85kMD7#J9v8Q2)u z85kI)w6-%aYB6tRVAm2z5lGp_z^lc!jX_XrH-l)T03XYC2JvkSk^+2t8Dt}wcQeRF z3dwJ0Pz;V_0kc)WY*sK^4a{Z(vo*kMb}(BD%;o^Ib--)^h$1}*2cpUV!ht9=f^ay& zdQ2c3E-=Ro!r=yUEFc^nFvkkQ;RSPSKpY=!U!8q+%w{a2EV7Fj40J?UjI3C9GuTB+ zvTAK-aIj*NWR+yw#^4O0+_fZGw=sB!x3DlS|9?Si8-xEwaM*=2Ffdp#@G&qja5Atk za4~Q)a5D%p@Gyum@G__{@H5OL4zTJ zfq_Asf$2ZPBL-G>1`c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.java +++ b/DEV2.1/TP09/02_Playlist/Fenetre.java @@ -2,33 +2,57 @@ import java.awt.*; import javax.swing.*; public class Fenetre extends JFrame { + + private JLabel2 actif; + private boolean estActif; + public Fenetre() { + this.estActif = false; this.setLocation(100, 100); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLayout(new GridLayout(14, 1)); - JLabel[] chromakopia = { - new JLabel("St. Chroma"), - new JLabel("Rah Tah Tah"), - new JLabel("Noid"), - new JLabel("Darling, I"), - new JLabel("Hey Jane"), - new JLabel("I Killed You"), - new JLabel("Judge Judy"), - new JLabel("Sticky"), - new JLabel("Take Your Mask Off"), - new JLabel("Tomorrow"), - new JLabel("Thought I Was Dead"), - new JLabel("Like Him"), - new JLabel("Balloon"), - new JLabel("I Hope You Find Your Way Home") + JLabel2[] chromakopia = { + new JLabel2("St. Chroma"), + new JLabel2("Rah Tah Tah"), + new JLabel2("Noid"), + new JLabel2("Darling, I"), + new JLabel2("Hey Jane"), + new JLabel2("I Killed You"), + new JLabel2("Judge Judy"), + new JLabel2("Sticky"), + new JLabel2("Take Your Mask Off"), + new JLabel2("Tomorrow"), + new JLabel2("Thought I Was Dead"), + new JLabel2("Like Him"), + new JLabel2("Balloon"), + new JLabel2("I Hope You Find Your Way Home") }; - for (JLabel titre : chromakopia) { - this.addMouseListener(new GestionSouris(titre)); + for (JLabel2 titre : chromakopia) { + GestionSouris gestion = new GestionSouris(titre, this); + titre.addMouseListener(gestion); + titre.setGestionnaireSouris(gestion); this.add(titre); } this.pack(); } + + public boolean getEstActif() { + return this.estActif; + } + + public void setEstActif(boolean n) { + this.estActif = n; + } + + public void setActif(JLabel2 n) { + this.actif = n; + } + + public JLabel2 getActif() { + return this.actif; + } + } \ No newline at end of file diff --git a/DEV2.1/TP09/02_Playlist/GestionSouris.class b/DEV2.1/TP09/02_Playlist/GestionSouris.class index 3be87e7c43d52d770859d7dd6010ef6c78689bec..f2c47ec2948fe811fae1f5db12f49404238dc2a8 100644 GIT binary pat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@opS7rw`zMg?WN^1)PJIgi( zUJ$*BL3kU3B#5<*K^9?v5CaPX1A`y~2ZIoU5Q8v-B!dV8BZD@YVHjp9;5JK~frCMU lK`4$vl0lL|ih+?q2W}Wn56ChwGUyUkroh0+pa%{FeE>oIMr8m1 diff --git a/DEV2.1/TP09/02_Playlist/GestionSouris.java b/DEV2.1/TP09/02_Playlist/GestionSouris.java index 895b7dc..2c23b90 100644 --- a/DEV2.1/TP09/02_Playlist/GestionSouris.java +++ b/DEV2.1/TP09/02_Playlist/GestionSouris.java @@ -4,10 +4,14 @@ import java.awt.*; public class GestionSouris implements MouseListener { - private JLabel titre; + private JLabel2 titre; + private Fenetre fenetre; + private JLabel2 actif; + private boolean actuelEstActif; - public GestionSouris(JLabel titre) { + public GestionSouris(JLabel2 titre, Fenetre fenetre) { this.titre = titre; + this.fenetre = fenetre; } public void mouseClicked(MouseEvent evenement) { @@ -20,14 +24,35 @@ public class GestionSouris implements MouseListener { } public void mouseExited(MouseEvent evenement){ - this.titre.setOpaque(true); - this.titre.setBackground(Color.WHITE); - this.titre.repaint(); + if (!this.actuelEstActif) { + this.titre.setOpaque(true); + this.titre.setBackground(null); + this.titre.repaint(); + } + else { + this.titre.setBackground(Color.LIGHT_GRAY); + this.titre.repaint(); + } } public void mousePressed(MouseEvent evenement){ - } + this.titre.setBackground(Color.LIGHT_GRAY); + this.actuelEstActif = true; + this.titre.repaint(); + + if (this.fenetre.getEstActif()) { + this.fenetre.getActif().setBackground(null); + this.fenetre.getActif().getGestionnaireSouris().setActuelEstActif(false); + this.fenetre.getActif().repaint(); + } + this.fenetre.setEstActif(true); + this.fenetre.setActif(this.titre); + } public void mouseReleased(MouseEvent evenement){ } + + public void setActuelEstActif(boolean n) { + this.actuelEstActif = n; + } } \ No newline at end of file diff --git a/DEV2.1/TP09/02_Playlist/JLabel2.class b/DEV2.1/TP09/02_Playlist/JLabel2.class new file mode 100644 index 0000000000000000000000000000000000000000..f53a08a001e029831d6d8f0d7d1e7f17d75e0246 GIT binary patch literal 450 zcmX^0Z`VEs1_mbvQ7#5124;2!79Ivx1~x_pp{&HR#0vf5^31$+eJ`KHq|_Wn1~!|_ zyv!0iMg~z0ACSC$PGVlVesD=qW?s6rW*8>}2LmTN0~ZeiHv$9WI2l+OxEL52_!$H+ z)o*2BM_13wz{Rc5}*9!#FEVXJdgo`JPbk%!i)?O#i=DOscDI&IVH|H`NgUJ1*t_~MT`tA z8lIYA>XTVqlA4!V#K@qi;REuUeqwoverj22UWq=60&9?Ea*PaOP|JMtOUqJoQ}aq- zw#qUnfNWJ{WROPK>H}2`Q3Q2_G7p0agDN9~7|apA`5@;boT851DX7Y{YrC_Qj0v+r3Klol+RnhJCCIEG$oOR&1G|<$ia^RX23{?;Z43gt8AKwrwlj$NXlZX_ zkks1EARDQry`4dR8-vnD1_lO326YAo1|25AOP1{DS_ W22BQT1~Ud821W)A1_lNu22B84ypBZx literal 0 HcmV?d00001 diff --git a/DEV2.1/TP09/03_Rectangle/Fenetre.java b/DEV2.1/TP09/03_Rectangle/Fenetre.java new file mode 100644 index 0000000..2c5916e --- /dev/null +++ b/DEV2.1/TP09/03_Rectangle/Fenetre.java @@ -0,0 +1,13 @@ +import java.awt.*; +import javax.swing.*; + +public class Fenetre extends JFrame { + public Fenetre() { + this.setSize(800, 500); + this.setLocation(100, 100); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + GestionSouris clicSouris = new GestionSouris(this); + this.addMouseListener(clicSouris); + this.addMouseMotionListener(new GestionMouvementSouris(this, clicSouris)); + } +} \ No newline at end of file diff --git a/DEV2.1/TP09/03_Rectangle/GestionMouvementSouris.class b/DEV2.1/TP09/03_Rectangle/GestionMouvementSouris.class new file mode 100644 index 0000000000000000000000000000000000000000..6921b15e011cf4b9a24f29af663ec8043c58a570 GIT binary patch literal 904 zcmX^0Z`VEs1_mbvdoBhh24;2!79Ivx1~x_pfvm)`ME#t^ymWp4q^#8B5=I6#o6Nk- z5<5l)W)00SP6iGJPId+^9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b/DEV2.1/TP09/03_Rectangle/GestionSouris.java new file mode 100644 index 0000000..96f1519 --- /dev/null +++ b/DEV2.1/TP09/03_Rectangle/GestionSouris.java @@ -0,0 +1,57 @@ +import java.awt.event.*; +import javax.swing.*; +import java.awt.*; + +public class GestionSouris implements MouseListener { + + private Fenetre fenetre; + private Rectangle rect; + private int debutX; + private int debutY; + private int finX; + private int finY; + + public GestionSouris(Fenetre fenetre) { + this.fenetre = fenetre; + } + + + public void mouseClicked(MouseEvent evenement) { + } + + public void mouseEntered(MouseEvent evenement){ + } + + public void mouseExited(MouseEvent evenement){ + } + + public void mousePressed(MouseEvent evenement){ + System.out.println("Appui simple"); + this.fenetre.add(new Rectangle(evenement.getX(), evenement.getY(), evenement.getX()+200, evenement.getY()+200)); + this.debutX = evenement.getX(); + this.debutY = evenement.getY(); + this.rect = new Rectangle(this.debutX, this.debutY, evenement.getX(), evenement.getY()); + //this.fenetre.add(rect); + this.fenetre.repaint(); + } + + public void mouseReleased(MouseEvent evenement){ + this.finX = evenement.getX(); + this.finY = evenement.getY(); + } + + public int getDebutX() { + return this.debutX; + } + + public int getDebutY() { + return this.debutY; + } + + public void setRect(int finX, int finY) { + this.rect.setBounds(this.debutX, this.debutY, finX, finY); + System.out.println("debut : [" + this.debutX + ", " + this.debutY + "]"); + System.out.println("fin : [" + finX + ", " + finY + "]"); + this.fenetre.repaint(); + } +} \ No newline at end of file diff --git a/DEV2.1/TP09/03_Rectangle/Main.class b/DEV2.1/TP09/03_Rectangle/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..4bfefb83950a56c39fa5c9da2b700b4ed920ea5c GIT binary patch literal 322 zcmX^0Z`VEs1_mbvF)jus24;2!79Ivx1~x_pfvm)`ME#t^ymWp4q^#8B5=I6#o6Nk- z5<5l)W)00Sb_Nbc26ng9ywsASR4xW~24)b!&BMUMz{|+MRh(K9mRX#cl#|NHz@iZa zQqRxGz~Y;jna9Y$;+&t7%E-X)lbM(5SDKrYS`?B9QJD*t7t@ILL0BJLQk0pOZmk){ z$iNkxUs{x$>Xr#ImJ?){9!MR7A_E@-69Wh^F))JM&%nqaz`(#D%fQIM$iTqBs$n6ZAKH4nX7`PC6_!yWO7#Nrt VI2c$Mco|q37#Tzu7#NrsL;=WKHL?Hz literal 0 HcmV?d00001 diff --git a/DEV2.1/TP09/03_Rectangle/Main.java b/DEV2.1/TP09/03_Rectangle/Main.java new file mode 100644 index 0000000..2768c3d --- /dev/null +++ b/DEV2.1/TP09/03_Rectangle/Main.java @@ -0,0 +1,6 @@ +public class Main { + public static void main(String[] args) { + Fenetre fenetre = new Fenetre(); + fenetre.setVisible(true); + } +} \ No newline at end of file diff --git a/DEV2.1/TP09/03_Rectangle/Rectangle.class b/DEV2.1/TP09/03_Rectangle/Rectangle.class new file mode 100644 index 0000000000000000000000000000000000000000..a36e131cbff6963dd8575420827c2ecd903e0a4e GIT binary patch literal 874 zcmX^0Z`VEs1_mbv2QCIC24;2!79Ivx1~x_pv8=?h#0vf5^31$+eJ|(y+=BeP)VvZ# z1~!|_yv!0iMh0dL%`i>|4hBwk1}+{3ZU!Dk2F{?=i2KJQHg2bYd2u21* zPmnS`9tM7p8mM?ANKBB2K?o$ql9rhl0TK}5VGxB0L~=2RGf1#ANb)d9F-S8q2!dRs zpIBa^?_QKxkdc{O%*eo&T$GwvlFG;+s-fwFA#csaz`-EP!yv~X&&a@$S?phsSXi10 zc6k&?N|A>_i9wl>fj2$1#3?a3JH05sG%tmbK?vC}=lq=fB5ROaRCyTG7}OaVIEqtC zz@m%{!Wsx$!9v!WVIY$=c^I@9v>6#V(o;*qGgC@3z?OP~q;z>0^gvRa>8T|ishQ~+ zB_Oj6co+;Bj2Ia>(lT>$K%vOUz^>ux>FEgyV-p5bb_O#Z26F}rMg~5(H^CM%GO#%L zgt{^^2%x)!k%7fIKP8osf!`-HFV(L!Hz~C!BrypTH+%(&nRz8hkt&Ad4_N40Ylbm0 z@CKJ8CTII57C?1!1?QI*C8xS&f{g(=6dc`pAV)DMGH@_3F)%Q&Fff7A0|NsC6DZEX zv=9Rim==Z7j0~&{MhuJ$mJAFGZVXHetPBhcQd-*?7`3FgGO%mOY-QlplHJN6pe4$( zl|gtT0|NsigB3^(0~-Sa12+Q;0}lfy11|#~10RDh13!Z#g8%~~gEfN<)XX*pHU?$} z1_lr9Z46?*TH6?8W->_XXl-Lq*v6ou!_2I;jX^_e8-va^27R4P48|Zqtt|}fT3Z-+ zwYD$_fY>QoTNs2v0x8=V^g%9Q0=qztft`VYL4<)7lvEkS7(^Jv8I%~L7&IBA8Qd9U a7;G6B7&sUh|1c=AGl(-VGT4FrZ4UtD$f)E1 literal 0 HcmV?d00001 diff --git a/DEV2.1/TP09/03_Rectangle/Rectangle.java b/DEV2.1/TP09/03_Rectangle/Rectangle.java new file mode 100644 index 0000000..a10f79c --- /dev/null +++ b/DEV2.1/TP09/03_Rectangle/Rectangle.java @@ -0,0 +1,29 @@ +import java.awt.*; +import javax.swing.*; + +public class Rectangle extends JComponent { + + private int departX; + private int departY; + private int finX; + private int finY; + + public Rectangle(int departX, int departY, int finX, int finY) { + this.departX = departX; + this.departY = departY; + this.finX = finX; + this.finY = finY; + } + + @Override + public void paintComponent(Graphics pinceau) { + Graphics secondPinceau = pinceau.create(); + if (this.isOpaque()) { + secondPinceau.setColor(this.getBackground()); + secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); + } + + secondPinceau.setColor(Color.BLUE); + secondPinceau.fillRect(this.departX, this.departY, this.finX-this.departX, this.finY-this.departY); + } +} \ No newline at end of file diff --git a/DEV2.1/TP10/01_Plantages/ArithmeticExceptionApplication.class b/DEV2.1/TP10/01_Plantages/ArithmeticExceptionApplication.class new file mode 100644 index 0000000000000000000000000000000000000000..5942427cfddff18f0f739a3e40eed92ab7586d68 GIT binary patch literal 433 zcmX^0Z`VEs1_mbvX)XpP24;2!79Ivx1~x_pfvm)`ME#t^ymWp4q^#8B5=I6#o6Nk- z5<5l)W)00SP6iGJPId+^9tLg(9u(!lmBl5gxr_|V`K2X{45B_@gEI5=1Bx>9N`gy@ zQWJBnxfu8u_}Li*co+m3gcuowv8Z8WU@rja$jM`5VA1f@3}a^yVPueVEXpj&$W1ND zOm?kEPAw?O%+GTyD9Fi7P6RO-8Cab2Q&Jfj_%QjC^^+F6Qo!fzcqRw_cACl2s1D-fB+K%BPi4u z7#Tzv7#L(37#SED7#LW!wlgqpWME)mWDsLuU|<6aGBR*7h%-n)m8vr^gGISFF|Z5p fGv{n$;6-Qv#RvlfGXoa`3j-sABm)Bj6N3~0_vKxP literal 0 HcmV?d00001 diff --git a/DEV2.1/TP10/01_Plantages/ArithmeticExceptionApplication.java b/DEV2.1/TP10/01_Plantages/ArithmeticExceptionApplication.java new file mode 100644 index 0000000..ab9becd --- /dev/null +++ b/DEV2.1/TP10/01_Plantages/ArithmeticExceptionApplication.java @@ -0,0 +1,5 @@ +public class ArithmeticExceptionApplication { + public static void main(String[] args) { + System.out.println(15/0); + } +} \ No newline at end of file diff --git a/DEV2.1/TP10/01_Plantages/ArrayIndexOutOfBoundsExceptionApplication.class b/DEV2.1/TP10/01_Plantages/ArrayIndexOutOfBoundsExceptionApplication.class new file mode 100644 index 0000000000000000000000000000000000000000..887ea7c7392614c2c786620ab33d7e22779ab9bb GIT binary patch literal 485 zcmX^0Z`VEs1_mbvX)XpP24;2!79Ivx1~x_pfvm)`ME#t^ymWp4q^#8B5=I6#o6Nk- z5<5l)W)00SP6iGJPId+^9tLg(9u(!lmBl5gxr_|V`K2X{45B_@gEI5=1Bx>9N`gy@ zQWJBnxfu8u_}Li*co+m3gcuowv8Z8WU@rja$jM`5VA1f@3}a^yVPw#BEGkN@^vp|1 zt?(}`@lSKgFU?CScCAQGEhx#%&vPs&$jMAj1Th&ISe)}yQW+WeeKPY>{YrC_Qj0Y+ylV22KWk1_7v24F)E#Q5=ju+8kRM*b%Dv X7?>Ftz!q^burqKmFfs^&EfN9%ZdXFO literal 0 HcmV?d00001 diff --git a/DEV2.1/TP10/01_Plantages/NullPointerExceptionApplication.java b/DEV2.1/TP10/01_Plantages/NullPointerExceptionApplication.java new file mode 100644 index 0000000..1668f95 --- /dev/null +++ b/DEV2.1/TP10/01_Plantages/NullPointerExceptionApplication.java @@ -0,0 +1,9 @@ +public class NullPointerExceptionApplication { + + private int a; + + public static void main(String[] args) { + NullPointerExceptionApplication test = null; + test.a = 5; + } +} \ No newline at end of file diff --git a/DEV2.1/TP10/01_Plantages/NumberFormatExceptionApplication.class b/DEV2.1/TP10/01_Plantages/NumberFormatExceptionApplication.class new file mode 100644 index 0000000000000000000000000000000000000000..ff1ba25ff68bb3c96fe7b9e98c8614410cdf71be GIT binary patch literal 406 zcmX^0Z`VEs1_mbvaV`cX24;2!79Ivx1~x_pfvm)`ME#t^ymWp4q^#8B5=I6#o6Nk- z5<5l)W)00S4h9ZJ26m_XysZ4vA}$6l25xo+9v%i>20lgxL4;nt+*}H138gFk%6Cqi2($d7#KkT!@$TO$iToL%fQIM$iTqBs1yo?N@ z8a@ae!6ikRdFj?5qxcyaq=QQHLXZt`EGWpyOil!u#mKQ=z$!@pvb_-z{CIoObm>m zfM8%`5MW?nkY!+GU}RumVAa~rz_^itfq{`hkb!}L4J^pSz{w!QAPiNi#J~&|<=V}_ Z9x24Roq>BlntB!nMg|cE1_mYuQ2?w2QZ@hp literal 0 HcmV?d00001 diff --git a/DEV2.1/TP10/01_Plantages/RunTimeExceptionApplication.java b/DEV2.1/TP10/01_Plantages/RunTimeExceptionApplication.java new file mode 100644 index 0000000..b8123ef --- /dev/null +++ b/DEV2.1/TP10/01_Plantages/RunTimeExceptionApplication.java @@ -0,0 +1,5 @@ +public class RunTimeExceptionApplication { + public static void main(String[] args) { + throw new RuntimeException("Rip"); + } +} \ No newline at end of file diff --git a/DEV2.1/TP10/02_Capture/ArithmeticExceptionApplication.class b/DEV2.1/TP10/02_Capture/ArithmeticExceptionApplication.class new file mode 100644 index 0000000000000000000000000000000000000000..e5b4bdf9ff5d0209708830fb257c89904c5e630e GIT binary patch literal 643 zcmX^0Z`VEs1_mbv6)pxQ24;2!79Ivx1~x_pfvm)`ME#t^ymWp4q^#8B5=I6#o6Nk- z5<5l)W)00SE(Q(;PId+^9tLg(9!3T^$D+)VjNH_c%w*S!84+TB?T> literal 0 HcmV?d00001 diff --git a/DEV2.1/TP10/02_Capture/ArithmeticExceptionApplication.java b/DEV2.1/TP10/02_Capture/ArithmeticExceptionApplication.java new file mode 100644 index 0000000..f2153fc --- /dev/null +++ b/DEV2.1/TP10/02_Capture/ArithmeticExceptionApplication.java @@ -0,0 +1,16 @@ +public class ArithmeticExceptionApplication { + + public static int division(int a, int b) { + // En mettant l'exception ici, on option une ligne de plus à l'exécution + return a/b; + } + + public static void main(String[] args) { + try { + ArithmeticExceptionApplication.division(7, 0); + } catch (ArithmeticException e) { + System.out.println("Erreur : Division par 0"); + } + } + +} \ No newline at end of file diff --git a/DEV2.1/TP10/03_Incomplet/Incomplet.class b/DEV2.1/TP10/03_Incomplet/Incomplet.class new file mode 100644 index 0000000000000000000000000000000000000000..ee73ab99e51a57b274110cf1bc260a7beb157c90 GIT binary patch literal 551 zcmX^0Z`VEs1_mbvB`yXg24;2!79Ivx1~x_pfvm)`ME#t^ymWp4q^#8B5=I6#o6Nk- z5<5l)W)00SP6iGJPId+^9tLg(9u(!lmBl5gxr_|V`K2X{45B_@gEI5=1Bx>9N`gy@ zQWJBnxfu8u_}Li*co+m3gcuowv8Z8WU@b4oEJF-*RoLW$l znV-kbAjZhR>6w?DpIeZVTEfV{;+&t7%E-X)lbM(5SDKrYS`?C)l#|NHz>=Gona9W= zrV$Ns6xescB}JKe>DHQIj10WNC5g$|zKI23_3R9?j10n9l(I9(GcqtmJ25hF1?QI* zC8xS&f=uUwJ3$ZR9R@`PQ3fUk5MW|p1O+MsBZD{t1A{CBBLgD?0|Tqpb_T|c3=9m6 z3=#|s3~XRQW(H0MNd_sX(mDnf24)5Z22%m{JsgqD0v;ieECQ(^k*oqaA(3n#f?Xg# zB$7jbHzZPkO@J%JXA=Xv_BICIB^yu8%JQbq<5 zpRB~P#0vf5^31$+eXoGTywn_PE(Q(;PId+^9tLg(9!3TMkP`iz#JqHU|D>$cQFaC~9tLp+2}TAXkUmtGFf#BKrS4K_TrEH$r0-!Zu)Ge6HKv$!NRFSUq~K^&qH)qHEsFp%@|Q&Jfj_P# literal 0 HcmV?d00001 diff --git a/DEV2.1/TP10/04_Apparences/Fond$2.class b/DEV2.1/TP10/04_Apparences/Fond$2.class new file mode 100644 index 0000000000000000000000000000000000000000..4c603fd315a4eec01669de48bfa0e8c8d3d12e81 GIT binary patch literal 688 zcmX^0Z`VEs1_mbvZB7Oz24;2!79Ivx1~x_pHn;q|6cr;z2JW)N9F>B^yu8%JQbq<5 zpRB~P#0vf5^31$+eXoGTywn_PE(Q(;PId+^9tLg(9!3TMkP`iz#JqHU|D>$c4 zoL^d$oa&YdHVhO6dLTzKGVr_RCFkT9XXd5*rj}&nr?4}qGBU7$6!0*pGiWd}u;eCY z<}oseX+%SO3l9F^lA_GKbg;=BeyPPJ9{I&3j0`-Ud3mWt&N+$2#i_*%3JgpP91M&M zk_?Oj0-(5OU|?WkU|`^8kY-?FkYQk8P-0*Li*RXaZ)ITA+Rnhfk%57MkwKP$fq{*I zk%56hok0$)i-&=cL7qW@ff1}v9jcF8YYPM8CI;SZ48jPFTwo(L8Mqj<7+4q-!P=D= flo=QpSQu0o)EG3uA}S183=9lh42)pa3=9ka0>qY$ literal 0 HcmV?d00001 diff --git a/DEV2.1/TP10/04_Apparences/Fond$3.class b/DEV2.1/TP10/04_Apparences/Fond$3.class new file mode 100644 index 0000000000000000000000000000000000000000..b3a67feb3d3a2b34db8d4c541cd51feb6084c977 GIT binary patch literal 687 zcmX^0Z`VEs1_mbvZB7Oz24;2!79Ivx1~x_pHn;q|6cuAe2JW)N9F>B^yu8%JQbq<5 zpRB~P#0vf5^31$+eXoGTywn_PE(Q(;PId+^9tLg(9!3TMkP`iz#JqHU|D>$cS05k$a7G3J zux0viDQhkU5e89q1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HDylrktX zG%~0&^fBl%%w{lVSjb?)u!6yqVLgL6!&U|hhFuJn4CxFE3=$0N9_$SK3{LC}g3jy= z!p`grqR#9L;v5Xj3>gdz3``7}3|R~e3?P0eLlA=}LpB2ggA@ZZgC{7m85kIXpmZpN F1^`J@j*|cY literal 0 HcmV?d00001 diff --git a/DEV2.1/TP10/04_Apparences/Fond.java b/DEV2.1/TP10/04_Apparences/Fond.java new file mode 100644 index 0000000..08e9ac0 --- /dev/null +++ b/DEV2.1/TP10/04_Apparences/Fond.java @@ -0,0 +1,58 @@ +import java.awt.*; +import javax.swing.*; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +public class Fond { + public static void main(String[] args) { + try { + try { + UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); + } catch (ClassNotFoundException e) { + } + } catch (InstantiationException e2) { + } catch (IllegalAccessException e3) { + } catch (UnsupportedLookAndFeelException e4) { + } // On constate que les boutons changent d'apparence + catch (ClassCastException e5) { + System.out.println("Nom de manager incorrect"); + } // Les boutons restent comme avant + + JFrame fenetre = new JFrame(); + fenetre.setSize(300,200); + fenetre.setLocation(100,100); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + fenetre.setLayout(new GridLayout(1, 1)); + + JPanel panneau = new JPanel(); + + JButton bouton1 = new JButton("Cyan"); + JButton bouton2 = new JButton("Magenta"); + JButton bouton3 = new JButton("Jaune"); + + bouton1.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evenement) { + panneau.setBackground(Color.CYAN); + } + }); + + bouton2.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evenement) { + panneau.setBackground(Color.MAGENTA); + } + }); + + bouton3.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evenement) { + panneau.setBackground(Color.YELLOW); + } + }); + + panneau.add(bouton1); + panneau.add(bouton2); + panneau.add(bouton3); + + fenetre.add(panneau); + fenetre.setVisible(true); + } +} \ No newline at end of file diff --git a/DEV2.1/TP10/05_Degres/Conversion.class b/DEV2.1/TP10/05_Degres/Conversion.class new file mode 100644 index 0000000000000000000000000000000000000000..5fa4609d1696889a0f9ad43362e6ef3eafc7f197 GIT binary patch literal 374 zcmX^0Z`VEs1_mbvF)jus24;2!79Ivx1~x_pfvm)`ME#t^ymWp4q^#8B5=I6#o6Nk- z5<5l)W)00SHU}jJFko{K0n-d@4h|3oI|Cmh1DA7tURi2Uab|uVBLjDkFnXa%xU-W@)jbTVh60YF%QjC^^+F6Qr9TVTT^bxeSU7ybMfWM=&!mg8ae2$iUCQz#z-O$iT?Jz`&}toq=&9 z0|Nsig8%~q0~=V7k%5yzkUcJYy_X02m^bz2m@!n2m^QWdNe)E44e$YSoLtH Yi!g9zi!iX~qw8U3U}OLV6%&If0Q>1XNB{r; literal 0 HcmV?d00001 diff --git a/DEV2.1/TP10/05_Degres/Conversion.java b/DEV2.1/TP10/05_Degres/Conversion.java new file mode 100644 index 0000000..c50f39e --- /dev/null +++ b/DEV2.1/TP10/05_Degres/Conversion.java @@ -0,0 +1,9 @@ +public class Conversion { + public static double celsiusAFahrenheit(double n) { + return n*9/5+32; + } + + public static double FahrenheitACelsius(double n) { + return (n-32)*5/9; + } +} \ No newline at end of file diff --git a/DEV2.1/TP10/05_Degres/Degres.class b/DEV2.1/TP10/05_Degres/Degres.class new file mode 100644 index 0000000000000000000000000000000000000000..cd436927277468eed1d21423a14ed339008b6dc1 GIT binary patch literal 1365 zcmX^0Z`VEs1_mdFFfIlr24;2!79Ivx1~x_pv8=?h#0vf5^31$+eJ|(y+=BeP)VvZ# z1~!|_yv!0iMh0dL%`h$o4hBwk1}+{3ZU!Dk20@S}{lxMTefOfof{e`MVnznGYcCBefW$sonZz)_r90v2Ut5Y|Ar z04!t;@&X@&3=e}WgB&9RM|x^WcxFmT2G~+hkfjPd42mEr&h*q0kJQZcj1rL9$~+7z z462L_9BG+3IYFt(C5#O08lIk>o|<8t4C)LT>UQcMCg%E_%3!q*j!;Wv1q&a53mGFoOsK9tJ~@&78%lB~Bp!7qc@MGcpK)tbs?D zPhwJP4hMrNBLnlH4bEH)MhxblXte-E0>svw#JqI<;F6-uymV{LFb)PQuu?aWQUj1R zwmb}W4EBr+-07($F8Rr&x!|~$g@!cDqLS2#5`CDoH9LbNBZHuOYH>+sex4VS(;XO` zLDsu4GMGRj0Hz3lE_{~aRDQPaAHad%soDt z#U-hEsYQ$o>ZrD+mZjz)oDEY3O$t6d489D0j10_)DJhH$S`eM!Bn{64)=23XA;`$U z;+&t7%E-X)lbM(5SDKrYS`?C)l#|NHz*mr%nO6c=%E%ywWGpPFSZjtcGVlhMBqnG3 zCKf<-as}s?7A2>;WrB?1hU5)BkpCGJ8Tc5O7(jrDff1Bt85kM-85kI385kKD85kH? zwYD=bZe(C!U}OkjU|?Va3xdc%h9HPiMn48N26hGph8x=37}$NawlVO|WRTR++QuNf zjX_+8nOSQagS6H*2Kj9aN;;bu)G!2hGw4KaXVCM5(pD_G%mR*r3=0HAwlU~SvM>uo z!8p4aj3R|hwlkPnv4WYFASRn6t02Qt0Y?E5kOpf>HV`ig%G2G(V6&USAyQY8g=IT~ z(@q9gCI(3ssGuZ^E;CF}OLrTCceoZv4n(m+cx)gF8Cn@+7$!5wF)U}0 vXV}A_$Z&{3iQy!JGQ$N16^82!stmyl3=A9$jDHxE*g-Ty2m=EH6GJEfaYH`= literal 0 HcmV?d00001 diff --git a/DEV2.1/TP10/05_Degres/Degres.java b/DEV2.1/TP10/05_Degres/Degres.java new file mode 100644 index 0000000..57f7b38 --- /dev/null +++ b/DEV2.1/TP10/05_Degres/Degres.java @@ -0,0 +1,38 @@ +import java.awt.*; +import javax.swing.*; +import javax.swing.event.*; +import java.awt.event.*; + +public class Degres extends JComponent { + + @Override + public void paintComponent(Graphics pinceau) { + Graphics secondPinceau = pinceau.create(); + + if (this.isOpaque()) { + secondPinceau.setColor(this.getBackground()); + secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); + } + + secondPinceau.setColor(Color.ORANGE); + secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); + + JTextField celsius = new JTextField(); + JTextField fahrenheit = new JTextField(); + celsius.setBounds(0, 65, 160, 20); + fahrenheit.setBounds(0, 90, 160, 20); + + JLabel texteCelsius = new JLabel("°C"); + JLabel texteFahrenheit = new JLabel("°F"); + texteCelsius.setBounds(165, 65, 20, 20); + texteFahrenheit.setBounds(165, 90, 20, 20); + + celsius.getDocument().addDocumentListener(new GestionJTextField(celsius, fahrenheit, true)); + fahrenheit.getDocument().addDocumentListener(new GestionJTextField(fahrenheit, celsius, false)); + + this.add(celsius); + this.add(fahrenheit); + this.add(texteCelsius); + this.add(texteFahrenheit); + } +} \ No newline at end of file diff --git a/DEV2.1/TP10/05_Degres/Fenetre.class b/DEV2.1/TP10/05_Degres/Fenetre.class new file mode 100644 index 0000000000000000000000000000000000000000..a6ddeeb20377269b8713c3829c537bf6b488be20 GIT binary patch literal 529 zcmX^0Z`VEs1_mbvbuI=b24;2!79Ivx1~x_pp{&HR#0vf5^31$+eJ{77#N1Ry1~!|_ zyv!0iMh0dL%`h$o4hBwk1}+{3ZU!Dk26ng9ywsASR7M8&;?$Dh%&JsI238GEPl!T3 z9tM7pD(>Rc5}*9!#FEVXJaz^_Mh0P!J^G2|CHn3~nJGSrmHDM5TnqvX!XS6>fb05^GI_{Rlxu1{UZ1lvG9rexJ;|RKL>Pq|~C2#H5^5Mh33n{L-T2RJTkJ zhX)!|dLTbAC^B#`Ffo7tBLgES@EI5xlo=QpvKd&x;^tc085p$$8BPc?oY=;|t|gEn zkg|<|S8F$eKqL#xb_Sts3?f==+ZZHvGsr}4XOQ#J(%!}(AHI=+fq{`hg@J)ViGhQG tfq|8Qg@KKMkAa;*jDdqenSql*gMo{|fPtIAjDd%NkwKM#fq{uZ4FFrJZ!7=+ literal 0 HcmV?d00001 diff --git a/DEV2.1/TP10/05_Degres/Fenetre.java b/DEV2.1/TP10/05_Degres/Fenetre.java new file mode 100644 index 0000000..2f6377e --- /dev/null +++ b/DEV2.1/TP10/05_Degres/Fenetre.java @@ -0,0 +1,13 @@ +import java.awt.*; +import javax.swing.*; + +public class Fenetre extends JFrame { + public Fenetre() { + this.setSize(200, 200); + this.setLocation(100, 100); + this.setLayout(new GridLayout(1, 1)); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + Degres composant = new Degres(); + this.add(composant); + } +} \ No newline at end of file diff --git a/DEV2.1/TP10/05_Degres/GestionJTextField.class b/DEV2.1/TP10/05_Degres/GestionJTextField.class new file mode 100644 index 0000000000000000000000000000000000000000..74ba1b21f61803f3f6dae1fb726f18e79ba5c13a GIT binary patch literal 1814 zcmX^0Z`VEs1_mdFNG=8@24;2!79Ivx1~x_pfvm)`ME#t^ymWp4q^#8B5=I6#o6Nk- z5<5l)W)00SP6iGJPId+^9tLg(9!3U1_tfH&%=|pBkkpD2x6IU>6h;QFMCbgxvecrI z%pyhx2_KMw75c^HnR)5@2xZnFgZOwD_(7)dCc`v@r4|)~WCVE_gcyVw8Ca4-^4%C2 z7^AotL>a``8N_)QBp4(a8N{%g%E-W;o>~HO3nPPwh9=lylrZl#|NHz+I47RGbRqiE3b)q3OcKpva)a&Y;Z0pu(Wa$iM~hZ*gXR z9wUQLa%xU-W@)jbTVh60YFGLocfSe|TaD}5Y z#9^S2G~!_}2E{geQEEYAW?l(9gDE3}d=@#!Qu9jmUGkGlb5rw5d@_qm zQu9)a7#U0;VGL7-lt#c|k3~F6GmMde#W_DEm63tpCo?Y<;@*%%a18P$XC&sOr>2A! zq$HN4GBT*3nvd!XSCFHuLFVyf<`t(FmB4iI2A3ozXZt1=fK6p*aDjRm<{T`>urs(Z zG6;jb3`uh#8AbW!5I6A@rRL_BrNRv73eGPrN=|jl1f@7Jj69?VGJ}ypz$rh!q`0Ig zvA{RABqKkin1jKGk%5tspN+wfi@~2EfSn-_l%9eZ8B{O&GdB#F5t zCYR(FRWdTnfCL4KLWtQOiFqkGsl_Tj`T5zU1=iq@hbV&>ge(HJ0irRavLF>%5~@5J z$plD2VvU@vp+-0-=HvutmZVxUGVplj<)s!m=Oh*vrxvp_gfcRyV)zMSBdSx`8NwME zGk->_AnSlvZgfTEMFo6moFfGI&%)r3F!obMD%3#C5$Y9IB zz+l6`#K6M9z#yWvoq=+mr#28o^7#MgNSQz*i zI2rgE_!tBjgc$@G7#Zvt9H1sig6&{nU_@wRV_;-pU=U?sWN?HjW7K9~1{+qUwS_@o zCWE}z76x9eEe!127({k3NbO)y*u|j6z_5)$YdM1qx||+N4kWRS!EiZ)kuQiTWCm8x z;s@e@#ihXFU?#s63shK=W&cJ7Hn6AN7)%)483GuB87#p3I4GUTz`)?f5W)bWGa0hM zG!r-o+!zEI7#O4&*cqf5lo{k0Y#7uToEbD2+!z!X+!>S@0vJ>nf*F(DAmw}nV1049C3|*xM489DE4BiaE3=9lh O42%pR3}Flr43Yq}wYm)e literal 0 HcmV?d00001 diff --git a/DEV2.1/TP10/05_Degres/GestionJTextField.java b/DEV2.1/TP10/05_Degres/GestionJTextField.java new file mode 100644 index 0000000..ab07d64 --- /dev/null +++ b/DEV2.1/TP10/05_Degres/GestionJTextField.java @@ -0,0 +1,46 @@ +import java.awt.event.*; +import java.awt.*; +import javax.swing.*; +import javax.swing.event.*; + +public class GestionJTextField implements DocumentListener { + + + private JTextField aConvertir; + private JTextField convertirVers; + private boolean cToF; + + public GestionJTextField(JTextField aConvertir, JTextField convertirVers, boolean cToF) { + this.aConvertir = aConvertir; + this.convertirVers = convertirVers; + this.cToF = cToF; + } + + + public void changedUpdate(DocumentEvent e) { + } + + + public void insertUpdate(DocumentEvent e) { + try { + if (this.cToF) { + this.convertirVers.setText(Conversion.celsiusAFahrenheit(Double.parseDouble(this.aConvertir.getText())) + ""); + } + else { + this.convertirVers.setText(Conversion.FahrenheitACelsius(Double.parseDouble(this.aConvertir.getText())) + ""); + } + } catch (NumberFormatException e2) { + try { + this.convertirVers.setText("???"); + } catch (IllegalStateException ee) { + } + } catch (IllegalStateException e3) { + } finally { + this.convertirVers.repaint(); + } + } + + + public void removeUpdate(DocumentEvent e) { + } +} \ No newline at end of file diff --git a/DEV2.1/TP10/05_Degres/Main.class b/DEV2.1/TP10/05_Degres/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..4bfefb83950a56c39fa5c9da2b700b4ed920ea5c GIT binary patch literal 322 zcmX^0Z`VEs1_mbvF)jus24;2!79Ivx1~x_pfvm)`ME#t^ymWp4q^#8B5=I6#o6Nk- z5<5l)W)00Sb_Nbc26ng9ywsASR4xW~24)b!&BMUMz{|+MRh(K9mRX#cl#|NHz@iZa zQqRxGz~Y;jna9Y$;+&t7%E-X)lbM(5SDKrYS`?B9QJD*t7t@ILL0BJLQk0pOZmk){ z$iNkxUs{x$>Xr#ImJ?){9!MR7A_E@-69Wh^F))JM&%nqaz`(#D%fQIM$iTqBs$n6ZAKH4nX7`PC6_!yWO7#Nrt VI2c$Mco|q37#Tzu7#NrsL;=WKHL?Hz literal 0 HcmV?d00001 diff --git a/DEV2.1/TP10/05_Degres/Main.java b/DEV2.1/TP10/05_Degres/Main.java new file mode 100644 index 0000000..2768c3d --- /dev/null +++ b/DEV2.1/TP10/05_Degres/Main.java @@ -0,0 +1,6 @@ +public class Main { + public static void main(String[] args) { + Fenetre fenetre = new Fenetre(); + fenetre.setVisible(true); + } +} \ No newline at end of file