此JTable
与JScrollPane
不会显示列标题。带JScrollPane的表格将不会显示列标题
package jTable;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
public class Main {
JFrame frame ;
Main()
{
frame = new JFrame() ;
String [][] names = {
{"1000","yamen","develeoper"},
{"2000","aymen","data entry"},
{"3000","mohammed","teacher"}
};
String[] header = {"ID","NAME","JOB"};
JTable jtb = new JTable(names,header) ;
JScrollPane s = new JScrollPane(jtb);
jtb.setBounds(40,50,300,400);
frame.add(jtb);
frame.setSize(400, 500);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
new Main();
}
}
[* JTable可能重复将不显示列标题*](http://stackoverflow.com/q/2320812/230513)。 – trashgod