日期:2014-05-20  浏览次数:20708 次

jscrollpane有jtable设置标题出现问题。。
Jscrollpane中加入Jtable
使用如下代码设置Jtable标头:
		
String columnName[] ={"入库编号","商品名称","单价","数量","单位","总额","供应商","入库去向","入库时间","车辆","司机","押运员"};
table = new JTable(){
public boolean isCellEditable(int row, int column) //重写了isCellEditable方法
            { 
                       return false;//表格不允许被编辑
            }
};
dftm =(DefaultTableModel) table.getModel();
dftm.setColumnIdentifiers(columnName);//设置表头
scrollPane.setViewportView(table);

理论上应该是JTable表头显示在JSCrollPane标题的下方,但实际却显示在它上面,这是什么情况?????怎么解决

------解决方案--------------------
代码没贴完,border怎么设置的
GUI需要一步一步调整才能看到效果。
------解决方案--------------------
 To add a border around the main viewport, you can use setViewportBorder. (Of course, you can also add a border around the whole scroll pane using setBorder.)