Transférer les fichiers vers 'src/Test'

This commit is contained in:
Romain BESSON 2022-12-03 16:12:37 +01:00
parent 53481c883b
commit da69910269
3 changed files with 116 additions and 67 deletions

View File

@ -127,9 +127,6 @@ public class Controller implements ActionListener, ListSelectionListener {
this.currentJTableUse = liste; this.currentJTableUse = liste;
this.parent.updateTable(liste); this.parent.updateTable(liste);
//forModal.add(liste);
//BFrame frame = new BFrame(frameTitle, loca_x, loca_y, size_x, size_y, this.parent, forModal);
} }
/** /**
@ -545,6 +542,37 @@ public class Controller implements ActionListener, ListSelectionListener {
value = tm.getValueAt(cell[0], i); value = tm.getValueAt(cell[0], i);
if(Objects.equals(value, "[DEPLACER]")) { if(Objects.equals(value, "[DEPLACER]")) {
addMoveStudent(tm, cell, "[DEPLACER]");
}
if(Objects.equals(value, "[AJOUTER]")) {
addMoveStudent(tm, cell, "[AJOUTER]");
}
}
}
}
}
private void addMoveStudent(TableModel tm, int[] cell, String action){
String[] stringSetAdd = {
"Ajouter ",
"Ajouter",
"Nouveau groupe de l'eleve : "
};
String[] stringSetMove = {
"Deplacer ",
"Deplacer",
"Deplacer l'eleve : "
};
String[] stringSet;
if (action == "[AJOUTER]"){
stringSet = stringSetAdd;
} else {
stringSet = stringSetMove;
}
JPanel forModal = new JPanel(new GridBagLayout()); JPanel forModal = new JPanel(new GridBagLayout());
BLayout settings = new BLayout(); BLayout settings = new BLayout();
@ -555,7 +583,7 @@ public class Controller implements ActionListener, ListSelectionListener {
settings.setPositionX(0); settings.setPositionX(0);
settings.setPositionY(0); settings.setPositionY(0);
JLabel intro = new JLabel( JLabel intro = new JLabel(
"Deplacer " + tm.getValueAt(cell[0], 0) + " " + stringSet[0] + tm.getValueAt(cell[0], 0) + " " +
tm.getValueAt(cell[0], 1) + tm.getValueAt(cell[0], 1) +
" dans le groupe : " " dans le groupe : "
); );
@ -590,13 +618,13 @@ public class Controller implements ActionListener, ListSelectionListener {
settings.setPositionX(6); settings.setPositionX(6);
settings.setPositionY(0); settings.setPositionY(0);
JButton moveBtn = new JButton("Deplacer"); JButton moveBtn = new JButton(stringSet[1]);
moveBtn.setActionCommand("crtll::ActionAddAndMoveGrup"); moveBtn.setActionCommand("crtll::ActionAddAndMoveGrup");
moveBtn.addActionListener(this); moveBtn.addActionListener(this);
forModal.add(moveBtn, settings); forModal.add(moveBtn, settings);
DisplayModal( DisplayModal(
"Deplacer l'eleve : " stringSet[2]
+ tm.getValueAt(cell[0], 0) + " " + tm.getValueAt(cell[0], 1), + tm.getValueAt(cell[0], 0) + " " + tm.getValueAt(cell[0], 1),
500, 500,
250, 250,
@ -604,14 +632,7 @@ public class Controller implements ActionListener, ListSelectionListener {
this.av.getY(), this.av.getY(),
forModal forModal
); );
} this.parent.updateTable(this.initTable());
if(Objects.equals(value, "[AJOUTER]")) {
System.out.println("Ajout");
}
}
}
}
} }
public JTable initTable() { public JTable initTable() {
@ -625,8 +646,7 @@ public class Controller implements ActionListener, ListSelectionListener {
Object[] info = { Object[] info = {
this.e.get(i).getNom(), this.e.get(i).getNom(),
this.e.get(i).getPrenom(), this.e.get(i).getPrenom(),
String.valueOf(this.e.get(i).getGroupe()), String.valueOf(this.e.get(i).getGroupe())
"[DEPLACER]"
}; };
data[i] = info; data[i] = info;
} }

View File

@ -26,8 +26,8 @@ public class CustomJButton extends JButton {
private void init() { private void init() {
this.setFont(font); this.setFont(font);
this.setFocusPainted(false); this.setFocusPainted(false);
//this.setContentAreaFilled(false); this.setContentAreaFilled(false);
this.setBorderPainted(false); //this.setBorderPainted(false);
this.setBorder(new RoundedBorder(radius)); this.setBorder(new RoundedBorder(radius));
} }
} }

View File

@ -0,0 +1,29 @@
package Test;
import javax.swing.border.Border;
import java.awt.*;
public class RoundedBorder implements Border {
private int radius;
RoundedBorder(int radius) {
this.radius = radius;
}
public Insets getBorderInsets(Component c) {
return new Insets(this.radius+1, this.radius+1, this.radius+2, this.radius);
}
public boolean isBorderOpaque() {
return true;
}
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
g.drawRoundRect(x, y, width-1, height-1, radius, radius);
}
}