开发者

change jtable's column hedding according different actionPerforms

开发者 https://www.devze.com 2023-02-04 16:40 出处:网络
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 s

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

精彩评论

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