开发者

change jtable's column hedding according different actionPerforms

I have a Jtable extending AbstractTableModel,And I have differnt buttons in my form ,When click on different buttons differnt types of data is lo开发者_StackOverflow中文版aded in the table,I want to set suitable column hedding on different click of buttons


Since "different types of data" must be loaded to the JTable, you need different AbstractTableModels. myModelA, myModelB, myModelC etc.

You can set the appropriate model with:

  myTable.setModel(new myModelA());

and

  myTable.setModel(new myModelB());

etc, at the ActionListener - actionPerformed() of your buttons. Each model will provide headings for the appropriate data.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜