» Poradna » Programy

Java - JTable

 |   | 

Zdravím,

mám problém, že se mi v tabulce nezobrazují názvy sloupců :( nevíte co s tím ? tohle je uryvek kodu. Díky za případné odpovědi.

String[] nazvy = {"First Name",
"Last Name",
"Sport",
"# of Years",
"Vegetarian"};

Object[][] data = {
{"Mary", "Campione",
"Snowbokding", new Integer(5), new Boolean(false)},
{"Alison", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour",
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne",
"Pool", new Integer(10), new Boolean(false)}
};
Object[][] data2 = {
{"Mary", "Campione",
"Snowbokding", new Integer(5), new Boolean(false)},
{"Alijhgjghjson", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour",
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne",
"Pool", new Integer(10), new Boolean(false)}
};

tabulkaTable = new JTable(data, nazvy);
tabulkaTable.setEnabled(false);
tabulkaTable2 = new JTable(data2, nazvy);
tabulkaTable2.setEnabled(false);

tabulkaPane = new JTabbedPane();
tabulkaPane.addTab("Seznam objednávek", tabulkaTable);
tabulkaPane.addTab("Rozpis služeb", tabulkaTable2);

hlavniOknoFrame.add(tabulkaPane);

Mohlo by vás také zajímat


Související témata: False, Mary, Reading, Pool