This commit is contained in:
pro.boooooo 2022-11-27 14:14:19 +01:00
parent f6253edc8c
commit c37363dce6
9 changed files with 53 additions and 13 deletions

View File

@ -47,6 +47,7 @@ public class AdminView extends BFrame {
addStudGrup.setActionCommand("TODO");
this.add(addStudGrup, settings);
this.setResizable(false);
this.openBFrame();
this.refreshBFrame();
}

View File

@ -117,6 +117,7 @@ public class BFrame extends JFrame {
frame.getContentPane().add(scrollPane);
scrollPane.setViewportView(content);
frame.setResizable(false);
frame.setVisible(true);
}

View File

@ -3,17 +3,16 @@ package Test;
import API.Etudiant;
import API.Groupe;
import javax.swing.JTable;
import javax.swing.JOptionPane;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.TableModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Objects;
import javax.swing.JPanel;
import java.util.Arrays;
public class Controller implements ActionListener, ListSelectionListener {
private final BDatabase db;
@ -97,6 +96,21 @@ public class Controller implements ActionListener, ListSelectionListener {
BFrame frame = new BFrame(frameTitle, loca_x, loca_y, size_x, size_y, parent, forModal);
}
/**
* Pour afficher une modale classique pour plus de liberte (panel a creer au prealable)
*
* @param parent La fenetre qui sera bloque
* @param frameTitle Le titre de la fenetre
* @param size_x Taille en x
* @param size_y Taille en y
* @param loca_x Localisation en x
* @param loca_y Localisation en y
* @param forModal Le panel a mettre dans la fenetre (libre)
* */
private void DisplayModal(BFrame parent, String frameTitle, int size_x, int size_y, int loca_x, int loca_y, JPanel forModal, Object... data) {
BFrame frame = new BFrame(frameTitle, loca_x, loca_y, size_x, size_y, parent, forModal);
}
@Override
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
@ -262,19 +276,42 @@ public class Controller implements ActionListener, ListSelectionListener {
@Override
public void valueChanged(ListSelectionEvent e) {
int[] cell;
if(!e.getValueIsAdjusting()) {
int[] cell = this.currentJTableUse.getSelectedRows();
int collumnCount = this.currentJTableUse.getColumnCount();
Object value;
System.out.println(e.getSource());
if (!e.getValueIsAdjusting()) {
cell = this.currentJTableUse.getSelectedRows();
if (cell.length > 0) {
for (int i=0; i < 3; i++) {
if(cell.length > 0) {
for(int i = 0; i < collumnCount; i++) {
TableModel tm = this.currentJTableUse.getModel();
value = tm.getValueAt(cell[0], i);
System.out.print(value + " ");
}
System.out.println();
if(Objects.equals(value, "[DEPLACER]")) {
JPanel forModal = new JPanel(new GridBagLayout());
BLayout settings = new BLayout();
JLabel l = new JLabel("test");
forModal.add(l);
DisplayModal(
this.av,
"Deplacer l'eleve : " + tm.getValueAt(cell[0], 0) + " " + tm.getValueAt(cell[0], 1),
500,
250,
this.av.getX(),
this.av.getY(),
forModal,
/**
* Position toujours similaire { cell[0] = Nom (String), cell[1] = Prenom (String), cell[2] = Groupe (String) }
*/
tm.getValueAt(cell[0], 0),
tm.getValueAt(cell[0], 1),
tm.getValueAt(cell[0], 2)
);
}
}
}
}
}

View File

@ -116,6 +116,7 @@ public class ProfView extends BFrame {
searchTLetters.setActionCommand("pv::SearchStudentPer3Letters");
this.add(searchTLetters, settings);
this.setResizable(false);
this.openBFrame();
this.refreshBFrame();
}