开发者

view headers in JTable?

开发者 https://www.devze.com 2022-12-22 03:23 出处:网络
I can\'t view header in JTable while adding it into a JFrame.. String[] col={\"Name\",\"ID\",\"Marks\"};

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,co开发者_Go百科l);

The above code doesn't set header in JFrame. How to add view header in JTable while adding it into JFrame.....?


You need to add your table to a scroll pane, or explicitly add the header where you need it

JScrollPane scroller = new JScrollPane(table);

then add the scroll pane to your gui

0

精彩评论

暂无评论...
验证码 换一张
取 消