Java Code Examples for javax.swing.JTabbedPane#removeTabAt()

The following examples show how to use javax.swing.JTabbedPane#removeTabAt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestDataComponent.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 6 votes vote down vote up
private void deleteTestData(Object source) {
    JTabbedPane tab = (JTabbedPane) source;
    TestDataTablePanel panel = getSelectedData();
    if (!panel.isGlobalData) {
        int index = tab.getSelectedIndex();
        String name = tab.getTitleAt(index);
        int option = JOptionPane.showConfirmDialog(null, "Are you sure want to delete the TestData [" + name + "]", "Delete TestData", JOptionPane.YES_NO_OPTION);
        if (option == JOptionPane.YES_OPTION) {
            Boolean flag = testDesign.getProject().getTestData()
                    .getTestDataFor(envTab.getTitleAt(envTab.getSelectedIndex()))
                    .deleteTestData(name);
            if (flag) {
                tab.setSelectedIndex(index - 1);
                tab.removeTabAt(index);
            } else {
                Notification.show("Couldn't Delete Testdata - '" + name + "'");
            }
        }
    }
}
 
Example 2
Source File: CloseActionHandler.java    From zap-extensions with Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed(ActionEvent evt) {

    JTabbedPane ntp = getNumberedTabbedPane();

    int index = ntp.indexOfTab(getTabName());
    if (index >= 0) {
        if (ntp.getTabCount() > 2 && index == ntp.getTabCount() - 2) {
            ntp.setSelectedIndex(index - 1);
        }
        ManualHttpRequestEditorPanel currentEditor =
                (ManualHttpRequestEditorPanel) ntp.getComponentAt(index);
        currentEditor.beforeClose();
        currentEditor.saveConfig();
        ntp.removeTabAt(index);
    }
}
 
Example 3
Source File: TestDataComponent.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 5 votes vote down vote up
private void closeTestData(Object source) {
    JTabbedPane tab = (JTabbedPane) source;
    TestDataTablePanel panel = getSelectedData();
    if (!panel.isGlobalData) {
        int index = tab.getSelectedIndex();
        tab.setSelectedIndex(index - 1);
        tab.removeTabAt(index);
    }
}