I am using a JideTabbedPane
. which extends JTabbedPane
. After a user edits the name of a tab, I want to check whether the name meets certain criteria, e.g. the name must not be an empty string. If it doesn't meet the criteria, the old name of the tab should be used.
I used a TabEditingListener
to try to accomplish this task, but it didn't work. Here is what I wrote:
addTabEditingListener(new TabEditingListener() {
public void editingStopped(TabEditingEvent event) {
if (event.getNewTitle().isEmpty()) {
setTitleAt(event.getTabIndex(), event.getOldTitle());
}
}
}
Any ideas will be greatly appreciated.