Hi All, I'm using a JTabbedPane and want to do some field validation at the moment the user selects another Tab. Potentially, depending on their reply to a messagebox, keep them on the same tab to correct bad data. I'm implementing the ChangeListener interface and handling stateChanged events however getSelectedIndex() returns the newly selected tab. Is there easy way to 1) Determine which was the previously selected Tab and 2) Prevent the user from going to the newly selected Tab in the case of data validation failure? A stateChanged event cannot be consumed. Thanks in advance, Rob.
You can extends JTabbedPane to override the setSelectedIndex method and then call super.setSelectedIndex(index); after doing your validation something like:
It means our mission is in jeapordy! Quick, read this tiny ad!
a bit of art, as a gift, that will fit in a stocking