Package ui.label

Source Code of ui.label.DynamicTabLabel$CloseButtonListener

package ui.label;


import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

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

import ui.misc.CloseButton;
import ui.tabs.AbstractDynamicTab;


public class DynamicTabLabel extends JPanel
{
  private static final long serialVersionUID = -3914929158639846160L;

  private AbstractDynamicTab tab;

  public DynamicTabLabel(AbstractDynamicTab tab, String title)
  {
    setOpaque(false);

    BorderLayout layout = new BorderLayout();
    layout.setHgap(4);
    setLayout(layout);

    this.tab = tab;

    add(new JLabel(title), BorderLayout.CENTER);

    CloseButton closeButton = new CloseButton(new CloseButtonListener());
    add(closeButton, BorderLayout.EAST);
  }

  private class CloseButtonListener implements ActionListener
  {
    public void actionPerformed(ActionEvent event)
    {
      tab.close();
    }

  }

}
TOP

Related Classes of ui.label.DynamicTabLabel$CloseButtonListener

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.