package useful;

import java.awt.FlowLayout;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class ButtonTabComponent extends JPanel {

	private static final long serialVersionUID = 1L;
	
	private JLabel titleLabel;

	public ButtonTabComponent(String title, int index){
		super(new FlowLayout(FlowLayout.LEFT, 0, 0));
		
		setOpaque(false);
         
        //make JLabel read titles from JTabbedPane
        titleLabel = new JLabel(title);
        add(titleLabel);
        //add more space between the label and the button
        titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2));
        //tab button
        TabButton button = new TabButton(this);
        add(button);
        //add more space to the top of the component
        setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
    }
	
	public void changeTitle(String title){
		titleLabel.setName(title);
	}
}
