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

import java.awt.EventQueue;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;

import de.javasoft.swing.JYButton;
import de.javasoft.swing.IRotatableComponent.Rotation;

/**
 * Demonstrates JYButton widget usage.  
 */
@SuppressWarnings("serial")
public class SimpleJYButton extends JFrame
{
  public SimpleJYButton()
  {
    super("Simple JYButton Demo");
    
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.PAGE_AXIS));
    p.setBorder(new EmptyBorder(10,10,10,10));
    
    JYButton b1 = new JYButton("Regular");
    b1.setIcon(new ImageIcon(getClass().getResource("/resources/icons/tip.png")));
    b1.setRotation(Rotation.NONE);
    p.add(b1);
    
    p.add(Box.createVerticalStrut(10));
    
    JYButton b2 = new JYButton("Rotation.LEFT");
    b2.setIcon(new ImageIcon(getClass().getResource("/resources/icons/wizard.png")));
//@highlight
    b2.setRotation(Rotation.LEFT);
//@/highlight
    p.add(b2);

    p.add(Box.createVerticalStrut(10));

    JYButton b3 = new JYButton("Rotation.RIGHT");
    b3.setIcon(new ImageIcon(getClass().getResource("/resources/icons/clock.png")));
//@highlight
    b3.setRotation(Rotation.RIGHT);
//@/highlight
    p.add(b3);
    
    add(p);

    //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);      
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setSize(600, 400);
    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 SimpleJYButton();
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
      }
    });
  }  
}
