java actionlistener on a tab

对着背影说爱祢 提交于 2019-12-02 02:13:59

问题


Is it possible to put an actionlistener on a tab in swing? If it is please could you post a small example?


回答1:


The only way to do that is to add a javax.swing.event.ChangeListener to the JTabbedPane itself. You might have to keep track of the selected tab vs. previously selected tab depending on what you are doing with the state change...



来源:https://stackoverflow.com/questions/4443559/java-actionlistener-on-a-tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!