From 86f17311412d7c3cac8c98dca6c36a71424d4fab Mon Sep 17 00:00:00 2001 From: "emile.malcuit" Date: Thu, 13 Mar 2025 14:38:35 +0100 Subject: [PATCH] =?UTF-8?q?observation=20=C3=A0=20finir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/acces_aux_donnes/observationSQL.java | 19 ++++ .../src/presentation/jffInfoMedoc.form | 86 +++++++++++++++---- .../src/presentation/jffInfoMedoc.java | 79 ++++++++++++++--- 3 files changed, 154 insertions(+), 30 deletions(-) diff --git a/GSBapplication/src/acces_aux_donnes/observationSQL.java b/GSBapplication/src/acces_aux_donnes/observationSQL.java index 2789b3b..0a7e025 100644 --- a/GSBapplication/src/acces_aux_donnes/observationSQL.java +++ b/GSBapplication/src/acces_aux_donnes/observationSQL.java @@ -4,10 +4,12 @@ */ package acces_aux_donnes; +import java.lang.reflect.Array; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; +import java.util.ArrayList; /** * @@ -60,4 +62,21 @@ public class observationSQL { } return passer; } + + public ArrayList selectionObservation(String idMedoc){ + ArrayList observationMedoc = new ArrayList(); + try { + stmt = connexionTest.createStatement(); + // Accès à la table + result = stmt.executeQuery("SELECT observation FROM OBSERVATION WHERE idMedoc ='" + idMedoc +"';"); + while (result.next()){ + observationMedoc.add(result.getString(1)); + } + }catch(SQLException ex) { + System.out.println("SQLException : " + ex.getMessage()); + System.out.println("SQLState : " + ex.getSQLState()); + System.out.println("Code erreur : " + ex.getErrorCode()); + } + return observationMedoc; + } } diff --git a/GSBapplication/src/presentation/jffInfoMedoc.form b/GSBapplication/src/presentation/jffInfoMedoc.form index 6abf3b6..2cb1978 100644 --- a/GSBapplication/src/presentation/jffInfoMedoc.form +++ b/GSBapplication/src/presentation/jffInfoMedoc.form @@ -33,8 +33,9 @@ + - + @@ -48,7 +49,7 @@ - + @@ -85,6 +86,11 @@ + + + + + @@ -92,31 +98,27 @@ - + - + - + - + - + - - - - - + - - - - + + + + @@ -142,6 +144,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GSBapplication/src/presentation/jffInfoMedoc.java b/GSBapplication/src/presentation/jffInfoMedoc.java index 1196659..ef89bea 100644 --- a/GSBapplication/src/presentation/jffInfoMedoc.java +++ b/GSBapplication/src/presentation/jffInfoMedoc.java @@ -5,9 +5,10 @@ package presentation; import Metier.Medicament; +import acces_aux_donnes.observationSQL; import java.awt.Image; import java.awt.image.BufferedImage; -import javax.swing.Icon; +import java.util.ArrayList; import javax.swing.ImageIcon; /** @@ -15,7 +16,9 @@ import javax.swing.ImageIcon; * @author emile.lalorcey */ public class jffInfoMedoc extends javax.swing.JFrame { - + private ArrayList observation = new ArrayList(); + observationSQL observ = new observationSQL(); + /** * Creates new form jffInfoMedoc */ @@ -29,6 +32,10 @@ public class jffInfoMedoc extends javax.swing.JFrame { jLComposition.setText(medocTrouve.getComposition()); jLContrindication.setText(medocTrouve.getContreindication()); jLEffet.setText(medocTrouve.getEffet()); + observation = observ.selectionObservation(medocTrouve.getNom()); + if (observation.size()!= 0){ + jLObservation.setText(observation.get(0)); + } } @@ -49,12 +56,49 @@ public class jffInfoMedoc extends javax.swing.JFrame { jLImage = new javax.swing.JLabel(); jSeparator1 = new javax.swing.JSeparator(); jLEffet = new javax.swing.JLabel(); + jPanel1 = new javax.swing.JPanel(); + jBsuivant = new javax.swing.JButton(); + jBprecedent = new javax.swing.JButton(); + jLObservation = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLNomMedoc.setFont(new java.awt.Font("Segoe UI Black", 0, 18)); // NOI18N jLNomMedoc.setText("Nom du Médicament :"); + jBsuivant.setText("Suivant"); + + jBprecedent.setText("Précédent"); + + jLObservation.setText("Text"); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jBprecedent) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jBsuivant) + .addContainerGap()) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(24, 24, 24) + .addComponent(jLObservation, javax.swing.GroupLayout.PREFERRED_SIZE, 431, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(169, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jBsuivant) + .addComponent(jBprecedent)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLObservation, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(19, Short.MAX_VALUE)) + ); + javax.swing.GroupLayout jPFondLayout = new javax.swing.GroupLayout(jPFond); jPFond.setLayout(jPFondLayout); jPFondLayout.setHorizontalGroup( @@ -87,31 +131,33 @@ public class jffInfoMedoc extends javax.swing.JFrame { .addComponent(jLNomMedoc))) .addGap(0, 163, Short.MAX_VALUE))) .addContainerGap()) + .addGroup(jPFondLayout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPFondLayout.setVerticalGroup( jPFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPFondLayout.createSequentialGroup() .addContainerGap() .addComponent(jLNomMedoc) - .addGap(18, 18, 18) + .addGap(35, 35, 35) .addGroup(jPFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPFondLayout.createSequentialGroup() .addComponent(jLNomCo, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(28, 28, 28) .addComponent(jLComposition, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 60, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE) .addGroup(jPFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPFondLayout.createSequentialGroup() .addComponent(jLContrindication, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(169, 169, 169)) - .addGroup(jPFondLayout.createSequentialGroup() - .addComponent(jLEffet, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) - .addGroup(jPFondLayout.createSequentialGroup() - .addComponent(jLImage, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, Short.MAX_VALUE)))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE) + .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jLEffet, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(jLImage, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); @@ -126,8 +172,9 @@ public class jffInfoMedoc extends javax.swing.JFrame { layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() + .addContainerGap() .addComponent(jPFond, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(16, 16, 16)) + .addGap(10, 10, 10)) ); pack(); @@ -168,13 +215,17 @@ public class jffInfoMedoc extends javax.swing.JFrame { } // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jBprecedent; + private javax.swing.JButton jBsuivant; private javax.swing.JLabel jLComposition; private javax.swing.JLabel jLContrindication; private javax.swing.JLabel jLEffet; private javax.swing.JLabel jLImage; private javax.swing.JLabel jLNomCo; private javax.swing.JLabel jLNomMedoc; + private javax.swing.JLabel jLObservation; private javax.swing.JPanel jPFond; + private javax.swing.JPanel jPanel1; private javax.swing.JSeparator jSeparator1; // End of variables declaration//GEN-END:variables } -- 2.47.2