maj V1.0.1
This commit is contained in:
parent
b4a4bb3058
commit
d2149f298d
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,5 +1,4 @@
|
||||
package baseUFRHG;
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Map;
|
||||
@ -10,10 +9,10 @@ import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.border.BevelBorder;
|
||||
|
||||
public class gestionnaire extends JFrame {
|
||||
|
||||
@ -62,8 +61,8 @@ public class gestionnaire extends JFrame {
|
||||
cYears = new JComboBox<String>();
|
||||
cFormations = new JComboBox<String>();
|
||||
table = new JTable();
|
||||
table.setCellSelectionEnabled(true);
|
||||
table.setColumnSelectionAllowed(true);
|
||||
table.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
|
||||
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
|
||||
|
||||
for(noeud nChild : nBase.getChildren()) {
|
||||
@ -100,8 +99,8 @@ public class gestionnaire extends JFrame {
|
||||
// contentPane.add(table);
|
||||
|
||||
scrollPane_1 = new JScrollPane();
|
||||
scrollPane_1.setBounds(10, 71, 908, 515);
|
||||
scrollPane_1.setVisible(true);
|
||||
scrollPane_1.setViewportBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
|
||||
scrollPane_1.setBounds(10, 71, 1164, 515);
|
||||
|
||||
contentPane.add(scrollPane_1);
|
||||
scrollPane_1.setViewportView(table);
|
||||
@ -120,19 +119,18 @@ public class gestionnaire extends JFrame {
|
||||
noeud nFormation = nYears.getChild(cFormations.getSelectedItem().toString());
|
||||
|
||||
String[] head = new String[31] ;
|
||||
String[][] data = new String[nFormation.getChildren().size()][31] ;
|
||||
String[][] data = new String[nFormation.getChildren().size()-1][31] ;
|
||||
|
||||
int indexRow = 0;
|
||||
for(noeud nStudent : nFormation.getChildren()) {
|
||||
int indexCol = 0;
|
||||
head = new String[nStudent.getAttributes().size()];
|
||||
for (Map.Entry<String, String> entry : nStudent.getAttributes().entrySet()) {
|
||||
if(indexRow==0) {
|
||||
String key = entry.getKey();
|
||||
head[indexCol] = key;
|
||||
}else {
|
||||
String value = entry.getValue();
|
||||
data[indexRow][indexCol] = value;
|
||||
data[indexRow-1][indexCol] = value;
|
||||
}
|
||||
indexCol++;
|
||||
}
|
||||
@ -140,18 +138,25 @@ public class gestionnaire extends JFrame {
|
||||
}
|
||||
|
||||
|
||||
TableColumnModel columnModel = table.getColumnModel();
|
||||
for (int columnIndex = 0; columnIndex < table.getColumnCount(); columnIndex++) {
|
||||
// Obtention de la colonne à l'index donné
|
||||
TableColumn column = columnModel.getColumn(columnIndex);
|
||||
column.setHeaderValue(head[columnIndex]);
|
||||
// Ajustement de la largeur préférée de la colonne
|
||||
column.setWidth(300);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
table.setModel(new DefaultTableModel(data, head));
|
||||
|
||||
|
||||
|
||||
|
||||
for (int columnIndex = 0; columnIndex < table.getColumnCount(); columnIndex++) {
|
||||
// Obtention de la colonne à l'index donné
|
||||
table.getColumnModel().getColumn(columnIndex).setWidth(100);
|
||||
// column.setHeaderValue(head[columnIndex]);
|
||||
// Ajustement de la largeur préférée de la colonne
|
||||
// column.setWidth(300);
|
||||
}
|
||||
|
||||
|
||||
|
||||
table.revalidate();
|
||||
table.repaint();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user