• Post Reply Bookmark Topic Watch Topic
  • New Topic

Active PanelTab ? How can I find it ?  RSS feed

 
peter petros
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have 20 jtable with names TABLE_1, ... ,TABLE_20   (in a pannelTab)
In these tables I have data of list   List<STUDENT> students based on some criteria.

Moreover, I am using 20 DefaultTableModel called model1, ...model20

I want to click on a button and edit a row of the STUDENT but I don;t know how can I
get the current tab in order to use the appropriate model.

Could you help me please with an example ?

 
Rob Camick
Ranch Hand
Posts: 2828
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add a ListSelectionListener to each table.

Then when an event is generated you can get the component that currently has focus from the KeyboardFocusManager.

Then you save the table reference to an instance variable in your class that you can reference from the ActionListener you add to your button.

 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!