此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