232 lines
13 KiB
Java
Raw Blame History

/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
*/
package presentation;
import Metier.Medicament;
import acces_aux_donnes.observationSQL;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import javax.swing.ImageIcon;
/**
*
* @author emile.lalorcey
*/
public class jffInfoMedoc extends javax.swing.JFrame {
private ArrayList<String> observation = new ArrayList<String>();
observationSQL observ = new observationSQL();
/**
* Creates new form jffInfoMedoc
*/
public jffInfoMedoc(Medicament medocTrouve) {
initComponents();
jLNomCo.setText(medocTrouve.getNom());
//Icon imgMedoc = new javax.swing.ImageIcon(getClass().getResource("/img/" + medocTrouve.getImg() + ".jpg"));
//jLImage.setIcon(imgMedoc);
BufferedImage imgResize = null;
jLImage.setIcon(new ImageIcon(new javax.swing.ImageIcon(getClass().getResource("/img/" + medocTrouve.getImg() + ".jpg")).getImage().getScaledInstance(200, 50, Image.SCALE_SMOOTH)));
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));
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPFond = new javax.swing.JPanel();
jLNomMedoc = new javax.swing.JLabel();
jLNomCo = new javax.swing.JLabel();
jLComposition = new javax.swing.JLabel();
jLContrindication = new javax.swing.JLabel();
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<EFBFBD>c<EFBFBD>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(
jPFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPFondLayout.createSequentialGroup()
.addGroup(jPFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPFondLayout.createSequentialGroup()
.addGroup(jPFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPFondLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jPFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPFondLayout.createSequentialGroup()
.addComponent(jLContrindication, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLEffet, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPFondLayout.createSequentialGroup()
.addGroup(jPFondLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPFondLayout.createSequentialGroup()
.addComponent(jLComposition, javax.swing.GroupLayout.PREFERRED_SIZE, 265, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(140, 140, 140))
.addGroup(jPFondLayout.createSequentialGroup()
.addGap(183, 183, 183)
.addComponent(jLNomCo, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(78, 78, 78)))
.addComponent(jLImage, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(38, 38, 38))))
.addGroup(jPFondLayout.createSequentialGroup()
.addGap(168, 168, 168)
.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(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, 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, 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());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
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)
.addContainerGap())
);
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(10, 10, 10))
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(jffInfoMedoc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(jffInfoMedoc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(jffInfoMedoc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(jffInfoMedoc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
}
});
}
// 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
}