jtFilePath.getTableHeader().setBackground(color)
自己验证一下吧:)
import java.awt.*import javax.swing.*
public class Test
{
private JFrame jframe
private JTable jtable
public Test()
{
jframe=new JFrame("表格测试")
Object[][] num={{1,2,3},{4,5,6}}
String[] name={"字段一","字段二","字段三"}
jtable=new JTable(num,name)
jtable.setPreferredScrollableViewportSize(new Dimension(550,30))
jframe.getContentPane().add(jtable.getTableHeader(),BorderLayout.NORTH)
jframe.getContentPane().add(jtable,BorderLayout.CENTER)
jframe.pack()
jframe.setLocation(300,300)
jframe.setVisible(true)
jframe.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE)
}
public static void main(String[] ags)
{
Test t=new Test()
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)