/*
 * COPYRIGHT (c) 1999, Jan-Henrik Haukeland <hauk@tildeslash.com>
 */

package ts.ui;

import javax.swing.*;
import java.awt.*;

import ts.config.Constant;


/**  
 * A simple window with border decorations
 *
 * @author  Jan-Henrik Haukeland &lt;hauk@tildeslash.com&gt;
 * @version $Id: TsWindow.java,v 1.2 2001/08/19 15:54:05 hauk Exp $
 */
public class TsWindow extends JWindow
{

  public TsWindow()
  {
    super(new JFrame());
    setContentPane(new TsWindowUI());
  }
  

  protected class TsWindowUI extends JPanel
  {
    Color bgColor= new Color(204,204,204);

    {
      this.setLayout(new BorderLayout());
      this.setOpaque(true);
    }


    public void setBackground(Color c)
    {
      bgColor= c;
      this.repaint();
    }


    public void paintComponent(Graphics g)
    {
      Dimension d= this.getSize();
      g.clearRect(0,0,d.width, d.height);

      g.setColor(bgColor);
      g.fillRect(0,0,d.width, d.height);

      g.setColor(Color.black);
      g.drawRect(0, 0, d.width-1, d.height-1);
      g.drawRect(2, 2, d.width-5, d.height-5);

      g.setColor(Color.white);
      g.drawRect(1, 1, d.width-3, d.height-3);

      g.setColor(Color.black);
      g.drawLine(d.width-3, d.height-15, d.width, d.height-15);
      g.drawLine(d.width-15, d.height-3, d.width-15, d.height);
    }

    public Insets getInsets() 
    {
      return new Insets(4,4,4,4);
    }

  }
  
}
