無標題請看看下面的代碼JTable中
import java.awt.*;
import javax.swing.JTable;
import javax.swing.*;
public class Table extends JFrame
{
private JTable table;
public Table()
{
String[] columnNames = {"first name","last name","address"};
Object[][]data = {{"John","Kane","NY"},{"Nayomi","Writz","NY"}};
table = new JTable(data, columnNames);
getContentPane().add(table);
this.pack();
this.setVisible(true);
}
public static void main(String[]args)
{
new Table();
}
}
我以前沒有使用過JTable的,所以這是我第一次嘗試。在這裏,它不顯示列名,只顯示數據。這是爲什麼?請幫忙!
閱讀擺動標籤描述中引用的教程將會讓您失望很多:-) – kleopatra 2012-08-11 08:15:52
是的:)........... – 2012-08-12 14:09:09