在 JTable 中查看标题?
将 JTable 添加到 JFrame 时,我无法查看 JTable 中的标头。
String[] col={"Name","ID","Marks"};
Object[][] data={{"venkat",201,450},{"Ramesh",102,450},{"Rahul",2,430}, {"Thiman",4,434}};
table=new JTable(data,col);
上面的代码未在 JFrame 中设置标头。 如何在 JTable 中添加视图标题,同时将其添加到 JFrame 中......?
I can't view header in JTable while adding it into a JFrame..
String[] col={"Name","ID","Marks"};
Object[][] data={{"venkat",201,450},{"Ramesh",102,450},{"Rahul",2,430}, {"Thiman",4,434}};
table=new JTable(data,col);
The above code doesn't set header in JFrame.
How to add view header in JTable while adding it into JFrame.....?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将表添加到滚动窗格,或者在需要的位置显式添加标题,
然后将滚动窗格添加到 gui
You need to add your table to a scroll pane, or explicitly add the header where you need it
then add the scroll pane to your gui