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
|
import java.awt.Color;
import javax.swing.JTable;
import javax.swing.JFrame;
public class MaTable{
public static void main(String [] args){
Object[][] donnees = {
{"Swing", "Astral", "standard",
Color.red, Boolean.TRUE},
{"Swing", "Mistral", "standard",
Color.yellow, Boolean.FALSE},
{"Gin", "Oasis", "standard",
Color.blue, Boolean.FALSE},
{"Gin", "boomerang", "compétition",
Color.green, Boolean.TRUE},
{"Advance", "Omega", "performance",
Color.cyan, Boolean.TRUE},
} ;
String[] titreColonnes = { "marque", "modèle",
"homologation", "couleur", "vérifiée ?"};
JTable jTable1 = new JTable(donnees, titreColonnes);
JFrame frame = new JFrame("Ma Table");
frame.add(jTable1);
frame.setSize(200,200);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
} |
Partager