java如何设置JTable表格表头透明
1个回答
2018-11-20 · 百度知道合伙人官方认证企业
关注
展开全部
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();
}
}
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();
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询