e840. 监听JTabbedPane中选中卡片的改变

A tabbed pane fires a change event whenever the selected tab is changed either by the user or programmatically.

    // Create the tabbed pane
JTabbedPane pane = new JTabbedPane(); // Add tabs...; see e830 向JTabbedPane中加入一个卡片 // Register a change listener
pane.addChangeListener(new ChangeListener() {
// This method is called whenever the selected tab changes
public void stateChanged(ChangeEvent evt) {
JTabbedPane pane = (JTabbedPane)evt.getSource(); // Get current tab
int sel = pane.getSelectedIndex();
}
});
Related Examples
上一篇:[转]如何在ASP.NET Core中实现一个基础的身份认证


下一篇:.net chart(图表)控件的使用-System.Windows.Forms.DataVisualization.dll