A voir également:
- Traduier en java netbeans
- Waptrick java football - Télécharger - Jeux vidéo
- Jeux java itel football - Télécharger - Jeux vidéo
- Java apk - Télécharger - Langages
- Java décompiler - Télécharger - Langages
- Java runtime - Télécharger - Langages
3 réponses
KX
Messages postés
16754
Date d'inscription
samedi 31 mai 2008
Statut
Modérateur
Dernière intervention
25 novembre 2024
3 020
Modifié par KX le 20/09/2011 à 00:13
Modifié par KX le 20/09/2011 à 00:13
Les explications de ton problème ne m'étaient pas suffisamment claires pour tout comprendre alors c'est normal si mon code ne correspond pas tout à fait à ce que tu veux, mais à mon avis il ne te reste plus grand chose à faire :
private void calculerMontantAAfficher(int rowSelectionne) { DefaultTableModel tablemodel = (DefaultTableModel) ListeSeanceTable.getModel(); Float montant = (Float) tablemodel.getValueAt(rowSelectionne, 3); if ((Boolean) tablemodel.getValueAt(rowSelectionne, 6)) montant += Float.parseFloat(montantAPayerTextField.getText()); montantAAfficherTextField.setText(montant.toString()); }La confiance n'exclut pas le contrôle
KX
Messages postés
16754
Date d'inscription
samedi 31 mai 2008
Statut
Modérateur
Dernière intervention
25 novembre 2024
3 020
19 sept. 2011 à 22:42
19 sept. 2011 à 22:42
Fais voir le début de ton code (avec tous les composants que tu as déjà fait) ce sera plus simple de modifier que de tout recommencer.
package gestion_bptc_prepa;
/**
*
* @author bptc
*/
import application.objetmetier.Seance;
import application.objetmetier.Enseignant;
import application.objetmetier.Cycle;
import application.services.SeanceService;
import application.services.EnseignantService;
import application.services.CycleService;
import java.sql.*;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.table.DefaultTableModel;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
public class ListeSeanceEnseignantView extends javax.swing.JFrame {
private SeanceService seanceService = new SeanceService();
private PayementEnseignantView payementEnseignantView;
/** Creates new form ListeSeanceEnseignantView */
public ListeSeanceEnseignantView(PayementEnseignantView payementEnseignantView) throws SQLException {
initComponents();
this.payementEnseignantView = payementEnseignantView;
afficherDetailPayementSeance();
tableEventListener = new TableEventListener(this);
ListeSeanceTable.getSelectionModel().addListSelectionListener(tableEventListener);
}
/** 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">
private void initComponents() {
bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
montantAPayerTextField = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
ListeSeanceTable = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
jLabel1.setFont(new java.awt.Font("Georgia", 0, 12));
jLabel1.setText("Montant A Payer :");
org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, montantAPayerTextField, org.jdesktop.beansbinding.ELProperty.create("${false}"), montantAPayerTextField, org.jdesktop.beansbinding.BeanProperty.create("editable"));
bindingGroup.addBinding(binding);
jButton1.setFont(new java.awt.Font("Georgia", 1, 14));
jButton1.setText("Enregistrer");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setFont(new java.awt.Font("Georgia", 1, 14));
jButton2.setText("Annuler");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jLabel3.setFont(new java.awt.Font("Georgia", 0, 12));
jLabel3.setText("Dt");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(montantAPayerTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3)
.addGap(112, 112, 112)
.addComponent(jButton1)
.addGap(43, 43, 43)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(montantAPayerTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jLabel2.setFont(new java.awt.Font("Georgia", 1, 18));
jLabel2.setText("Liste Seances");
ListeSeanceTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Id Seance", "Date Seance", "Date Payement", "Tarif", "Salle", "Nb Heures", "Statut"
}
) {
Class[] types = new Class [] {
java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.Float.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Boolean.class
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
});
jScrollPane2.setViewportView(ListeSeanceTable);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGap(252, 252, 252)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 684, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(41, 41, 41)
.addComponent(jLabel2)
.addGap(30, 30, 30)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.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))
);
bindingGroup.bind();
pack();
}// </editor-fold>
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
this.setVisible(false);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
// Variables declaration - do not modify
private javax.swing.JTable ListeSeanceTable;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTextField montantAPayerTextField;
private org.jdesktop.beansbinding.BindingGroup bindingGroup;
// End of variables declaration
private ListSelectionListener tableEventListener;
private void addJTableLine(int id_Seance, String dateSeance, String datePayement, Boolean statut, String salle, int nbHeures, Float tarif) {
DefaultTableModel tablemodel = (DefaultTableModel) this.ListeSeanceTable.getModel();
Object[] objects = new Object[8];
objects[0] = id_Seance;
objects[1] = dateSeance;
objects[2] = datePayement;
objects[3] = tarif;
objects[4] = salle;
objects[5] = nbHeures;
objects[7] = statut;
tablemodel.addRow(objects);
}
private void afficherDetailPayementSeance() {
DefaultTableModel tablemodel = (DefaultTableModel) this.ListeSeanceTable.getModel();
tablemodel.setRowCount(0);
int idCycle = payementEnseignantView.getIdCycleSelectionne();
int id_enseignant = payementEnseignantView.getIdEnseignantSelectionne();
Vector seanceDetailPayement = seanceService.getSeanceParCycleParEnseignant(idCycle, id_enseignant);
for (int i = 0; i < seanceDetailPayement.size(); i++) {
Seance seance = (Seance) seanceDetailPayement.get(i);
addJTableLine(seance.getIdSeance(), seance.getDateSeance(), seance.getDatePayement(), seance.getStatut(), seance.getSalle(), seance.getNbHeures(), seance.getTarif());
}
}
public JTable getListSeanceTable() {
return this.ListeSeanceTable;
}
private void calculerMontantAAfficher(int rowSelectionne) {
// Si la colonne statut = true alors on additionne le montant a paye avec le tarif
// sinon on deduit la tarif
}
System.out.println("OK");
}
class TableEventListener implements ListSelectionListener {
private ListeSeanceEnseignantView listeSeanceEnseignantView;
public TableEventListener(ListeSeanceEnseignantView listeSeanceEnseignantView) {
this.listeSeanceEnseignantView = listeSeanceEnseignantView;
}
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
// The mouse button has not yet been released
return ;
}
if (e.getSource() == this.listeSeanceEnseignantView.getListSeanceTable().getSelectionModel()) {
if (this.listeSeanceEnseignantView.getListSeanceTable().getSelectedRow() != -1) {
this.listeSeanceEnseignantView.calculerMontantAAfficher(this.listeSeanceEnseignantView.getListSeanceTable().getSelectedRow());
}
}
}
}
}
/**
*
* @author bptc
*/
import application.objetmetier.Seance;
import application.objetmetier.Enseignant;
import application.objetmetier.Cycle;
import application.services.SeanceService;
import application.services.EnseignantService;
import application.services.CycleService;
import java.sql.*;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.table.DefaultTableModel;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
public class ListeSeanceEnseignantView extends javax.swing.JFrame {
private SeanceService seanceService = new SeanceService();
private PayementEnseignantView payementEnseignantView;
/** Creates new form ListeSeanceEnseignantView */
public ListeSeanceEnseignantView(PayementEnseignantView payementEnseignantView) throws SQLException {
initComponents();
this.payementEnseignantView = payementEnseignantView;
afficherDetailPayementSeance();
tableEventListener = new TableEventListener(this);
ListeSeanceTable.getSelectionModel().addListSelectionListener(tableEventListener);
}
/** 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">
private void initComponents() {
bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
montantAPayerTextField = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
ListeSeanceTable = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
jLabel1.setFont(new java.awt.Font("Georgia", 0, 12));
jLabel1.setText("Montant A Payer :");
org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, montantAPayerTextField, org.jdesktop.beansbinding.ELProperty.create("${false}"), montantAPayerTextField, org.jdesktop.beansbinding.BeanProperty.create("editable"));
bindingGroup.addBinding(binding);
jButton1.setFont(new java.awt.Font("Georgia", 1, 14));
jButton1.setText("Enregistrer");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setFont(new java.awt.Font("Georgia", 1, 14));
jButton2.setText("Annuler");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jLabel3.setFont(new java.awt.Font("Georgia", 0, 12));
jLabel3.setText("Dt");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(montantAPayerTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3)
.addGap(112, 112, 112)
.addComponent(jButton1)
.addGap(43, 43, 43)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(montantAPayerTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jLabel2.setFont(new java.awt.Font("Georgia", 1, 18));
jLabel2.setText("Liste Seances");
ListeSeanceTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Id Seance", "Date Seance", "Date Payement", "Tarif", "Salle", "Nb Heures", "Statut"
}
) {
Class[] types = new Class [] {
java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.Float.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Boolean.class
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
});
jScrollPane2.setViewportView(ListeSeanceTable);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGap(252, 252, 252)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 684, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(41, 41, 41)
.addComponent(jLabel2)
.addGap(30, 30, 30)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.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))
);
bindingGroup.bind();
pack();
}// </editor-fold>
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
this.setVisible(false);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
// Variables declaration - do not modify
private javax.swing.JTable ListeSeanceTable;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTextField montantAPayerTextField;
private org.jdesktop.beansbinding.BindingGroup bindingGroup;
// End of variables declaration
private ListSelectionListener tableEventListener;
private void addJTableLine(int id_Seance, String dateSeance, String datePayement, Boolean statut, String salle, int nbHeures, Float tarif) {
DefaultTableModel tablemodel = (DefaultTableModel) this.ListeSeanceTable.getModel();
Object[] objects = new Object[8];
objects[0] = id_Seance;
objects[1] = dateSeance;
objects[2] = datePayement;
objects[3] = tarif;
objects[4] = salle;
objects[5] = nbHeures;
objects[7] = statut;
tablemodel.addRow(objects);
}
private void afficherDetailPayementSeance() {
DefaultTableModel tablemodel = (DefaultTableModel) this.ListeSeanceTable.getModel();
tablemodel.setRowCount(0);
int idCycle = payementEnseignantView.getIdCycleSelectionne();
int id_enseignant = payementEnseignantView.getIdEnseignantSelectionne();
Vector seanceDetailPayement = seanceService.getSeanceParCycleParEnseignant(idCycle, id_enseignant);
for (int i = 0; i < seanceDetailPayement.size(); i++) {
Seance seance = (Seance) seanceDetailPayement.get(i);
addJTableLine(seance.getIdSeance(), seance.getDateSeance(), seance.getDatePayement(), seance.getStatut(), seance.getSalle(), seance.getNbHeures(), seance.getTarif());
}
}
public JTable getListSeanceTable() {
return this.ListeSeanceTable;
}
private void calculerMontantAAfficher(int rowSelectionne) {
// Si la colonne statut = true alors on additionne le montant a paye avec le tarif
// sinon on deduit la tarif
}
System.out.println("OK");
}
class TableEventListener implements ListSelectionListener {
private ListeSeanceEnseignantView listeSeanceEnseignantView;
public TableEventListener(ListeSeanceEnseignantView listeSeanceEnseignantView) {
this.listeSeanceEnseignantView = listeSeanceEnseignantView;
}
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
// The mouse button has not yet been released
return ;
}
if (e.getSource() == this.listeSeanceEnseignantView.getListSeanceTable().getSelectionModel()) {
if (this.listeSeanceEnseignantView.getListSeanceTable().getSelectedRow() != -1) {
this.listeSeanceEnseignantView.calculerMontantAAfficher(this.listeSeanceEnseignantView.getListSeanceTable().getSelectedRow());
}
}
}
}
}
KX
Messages postés
16754
Date d'inscription
samedi 31 mai 2008
Statut
Modérateur
Dernière intervention
25 novembre 2024
3 020
19 sept. 2011 à 23:20
19 sept. 2011 à 23:20
En fait ton code est incomplet, et vu qu'il est très long (je m'attendaiis à un code plus court pour un débutant) je ne vais pas te demander de me donner tout ce qui manque...
Il me faudrait cependant savoir de quel types est SéanceTable (qui n'est pas dans le code), le nom de l'objet JTextField où doit être affiché le résultat, ainsi que la case à cocher, bref tout ce qu'il est important de savoir pour faire ce que tu veux.
Il me faudrait cependant savoir de quel types est SéanceTable (qui n'est pas dans le code), le nom de l'objet JTextField où doit être affiché le résultat, ainsi que la case à cocher, bref tout ce qu'il est important de savoir pour faire ce que tu veux.
En faite c'est ListeSeanceTable pas SeanceTable c'est le tableau qui affiche le detail des séances(id_séanec, salle, nb_heures,enseignant, statut)
le JtextField est aussi c'est montantAPayerTextField c'est un jTxtField afficher au dessus de tableau
la case a cocher c'est Statut (seance paye ou non payé) a cocher si on va paye cette séance puis le JtxtField nous affiche le montant à payer
(on peut selectionner et cocher une ou plusieurs seances a la fois)
le JtextField est aussi c'est montantAPayerTextField c'est un jTxtField afficher au dessus de tableau
la case a cocher c'est Statut (seance paye ou non payé) a cocher si on va paye cette séance puis le JtxtField nous affiche le montant à payer
(on peut selectionner et cocher une ou plusieurs seances a la fois)
20 sept. 2011 à 12:19