1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
public class DataFileTable extends JPanel{
public JTable table;
// public JCheckBox chec=new JCheckBox();
public DataFileTable(String dataFilePath) {
//JTable table; // le tableau
DataFileTableModel model; // le modèle
//fonte
Font f=new Font("SanSerif",Font.PLAIN,24);
setFont(f);
//gestionnaire de positionnement
setLayout(new BorderLayout());
//construction du modèle de remplissage à partir du fichier
model = new DataFileTableModel(dataFilePath);
//création du tableau
table=new JTable();
table.setModel(model);
table.createDefaultColumnsFromModel();
JScrollPane scrollpane=new JScrollPane(table);
add(scrollpane);
}
public DataFileTable(String path,Vector vD, Vector vC){
JTable table=new JTable(vD,vC);
Font f=new Font("SanSerif",Font.PLAIN,24);
setFont(f);
setLayout(new BorderLayout());
//JScrollPane scrollpane=new JScrollPane(table);
JScrollPane scrollpane=new JScrollPane(table);
// scrollpane.add(chec);
add(scrollpane);
}
public Dimension getPreferredSize() {
return new Dimension(400, 300);
}
}
class WindowCloser extends WindowAdapter {
public void windowClosing(WindowEvent e) {
Window win=e.getWindow();
//effacer la fenêtre
win.setVisible(false);
//terminer le programme
System.exit(0);
}
} |
Partager