package de.javasoft.synthetica.democenter.examples.jytabbedpane;

import java.awt.Color;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.UIManager;

import de.javasoft.swing.JYTabbedPane;
import de.javasoft.swing.JYTabbedPane.CloseButtonStrategy;

/**
 * Simple JYTabbedPane demo with colorized tabs.  
 */
@SuppressWarnings("serial")
public class ColorizedTabsTabbedPane extends JFrame
{
  public ColorizedTabsTabbedPane()
  {
    super("ColorizedTabs JYTabbedPane");
    
    final JYTabbedPane tabbedPane = new JYTabbedPane();
    tabbedPane.setCloseButtonStrategy(CloseButtonStrategy.SELECTED_TAB);

    tabbedPane.addTab("Regular Tab", new JScrollPane(new JTextArea("Component A")));
    tabbedPane.addTab("Red Tab", new JScrollPane(new JTextArea("Component B")));
    tabbedPane.addTab("Green Tab", new JScrollPane(new JTextArea("Component C")));
    
//@highlight
    tabbedPane.putClientProperty("Synthetica.tabbedPane.tab.1.background", Color.RED);
    tabbedPane.putClientProperty("Synthetica.tabbedPane.tab.2.background", Color.GREEN);
    //tabbedPane.putClientProperty("Synthetica.tabbedPane.tab.2.background.alpha", 0.25f);
//@/highlight
    add(tabbedPane);
    
    //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);      
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setSize(400, 300);
    setLocationRelativeTo(null);        //center
    setVisible(true);
  }

  /**
   * Static main method for application startup. 
   */
  public static void main(String[] args)
  {
    EventQueue.invokeLater(new Runnable()
    {
      public void run()
      {
        try
        {
          UIManager.setLookAndFeel("de.javasoft.plaf.synthetica.SyntheticaStandardLookAndFeel");
          new ColorizedTabsTabbedPane();
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
      }
    });
  }  
}
