remove Tab By Title - Java Swing

Java examples for Swing:JTabbedPane

Description

remove Tab By Title

Demo Code


//package com.java2s;

import javax.swing.JTabbedPane;

public class Main {
    public static void removeTabByTitle(JTabbedPane itemPane, String title) {
        for (int i = 0; i < itemPane.getTabCount(); i++) {
            if (itemPane.getTitleAt(i).equals(title)) {
                itemPane.removeTabAt(i);
                break;
            }//from   w  ww .  j  a v  a  2 s. c  om
        }
    }
}

Related Tutorials