1

I have the following GUI:

enter image description here

The problem is, the [Register LMS] button should only be displayed when I'm on the Flood Monitoring tab.

When I go to the User Registration tab, another button should display called [Register User]. Obviously when I get back to the Flood Monitoring tab, I would need my [Register LMS] button back.

I know how to hide Swing components via the setVisible(false); method, but I am not sure how to add the trigger (action listener) to the change of tabs and nothing else.

J86
  • 14,345
  • 47
  • 130
  • 228
  • http://stackoverflow.com/questions/4443559/java-actionlistener-on-a-tab might help. – Nico Apr 21 '13 at 03:11

1 Answers1

5

Try adding a ChangeListener to the JTabbedPane, this is only called when the object changes state. i.e When the tab changes.

Sinkingpoint
  • 7,449
  • 2
  • 29
  • 45