import javax.swing.JInternalFrame;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public class Client extends JFrame
{
	JDesktopPane desktop;
	ClientFrame frame = null;
	public Client()
	{
        	super("TeamSpirit");
		int inset = 100;
        	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        	setBounds(2*inset, inset,screenSize.width - inset*4,screenSize.height-inset*2);
                addWindowListener(new WindowAdapter()
		{
            		public void windowClosing(WindowEvent e)
			{
                			if(frame.la != null)
						frame.la.logOff();
					if(frame.ca != null)
						frame.ca.logOff();
					if(frame.wba != null)
						frame.wba.logOff();
					if(frame.nba != null)
						frame.nba.logOff();
					System.exit(0);
			}
        	});

                desktop = new JDesktopPane();
        	createFrame();
        	setContentPane(desktop);
                desktop.putClientProperty("JDesktopPane.dragMode", "outline");
    		//setLF();
	}



    	protected void createFrame()
	{
        	frame = new  ClientFrame(desktop);
		frame.setVisible(true);
        	desktop.add(frame,JLayeredPane.DEFAULT_LAYER);
        	try
		{
            	frame.setSelected(true);
        	}
		catch (java.beans.PropertyVetoException e) {}

	}


	private void setLF()
	{
		String laf = UIManager.getSystemLookAndFeelClassName();
		try
		{
			UIManager.setLookAndFeel(laf);
		}
		catch (UnsupportedLookAndFeelException exc)
		{
			System.err.println("Unsupported: " + laf);
		}
		catch (Exception exc)
		{
			System.err.println("Error loading " + laf);
		}
	}

	public static void main(String[] args)
	{
        	Client frame = new Client();
        	frame.setVisible(true);
    	}
}
