/*
	A basic extension of the java.awt.Dialog class
 */

import java.awt.*;

public class AboutDialog extends Dialog {

	public AboutDialog(Frame parent, boolean modal)
	{
		super(parent, modal); 

		// This code is automatically generated by Visual Cafe when you add
		// components to the visual environment. It instantiates and initializes
		// the components. To modify the code, only use code syntax that matches
		// what Visual Cafe can generate, or Visual Cafe may be unable to back
		// parse your Java file into its visual environment.

		//{{INIT_CONTROLS
		setLayout(new BorderLayout(0,0));
		setSize(453,254);
		setVisible(false);
		label1.setText("PrintTextFile 1.3.1");
		label1.setAlignment(java.awt.Label.CENTER);
		add("North", label1);
		label1.setFont(new Font("Dialog", Font.BOLD, 12));
		label1.setBounds(0,0,453,23);
		textArea1.setText("text");
		add("Center", textArea1);
		textArea1.setFont(new Font("Serif", Font.PLAIN, 12));
		textArea1.setBounds(0,23,453,231);
		setTitle("About");
		//}}

		
		String str = "Perform hardcopy printing of multi-page single font text documents. \n\n"
		+ "Supports pagination, line wrap, line spacing, line separators, "
		+ "tab expansion, "
		+ "date and page numbering, font selection, "
		+ "margins, headers (CAN'T CHANGE IN FREE VERSION), footers, page range, page breaks, and "
		+ "print monitor job name."
		+ "\n"
		+ "\n"
		+ "(C) Copyright 1998-1999, Wildcrest Associates (http://www.wildcrest.com)"
		+ "\n"
		+ "\n"
        + "LICENSE and CONDITIONS OF USE"
        + "\n"
		+ "This application may be used, copied, and distributed without restriction provided "
		+ "you do not do so at a profit, the distribution package is complete and unmodified, "
		+ "and this notice is maintained.  This software is provided \"as is\" with no "
		+ "representations or warranties of any kind.  Use this software at your own risk, no "
		+ "liability whatsoever is assumed by Wildcrest Associates.";
		textArea1.setText(str);

		//{{REGISTER_LISTENERS
		SymWindow aSymWindow = new SymWindow();
		this.addWindowListener(aSymWindow);
		//}}

	}

	public AboutDialog(Frame parent, String title, boolean modal) 
	{
		this(parent, modal);
		setTitle(title);
	}

	public void addNotify()
	{
	    // Record the size of the window prior to calling parents addNotify.
	    Dimension d = getSize();
	    
		super.addNotify();

	    // Only do this once.
		if (fComponentsAdjusted)
			return;

		// Adjust components according to the insets
		setSize(getInsets().left + getInsets().right + getSize().width, getInsets().top + getInsets().bottom + getSize().height);
		Component components[] = getComponents();
		for (int i = 0; i < components.length; i++)
		{
			Point p = components[i].getLocation();
			p.translate(getInsets().left, getInsets().top);
			components[i].setLocation(p);
		}
		
        // Used for addNotify check.
		fComponentsAdjusted = true;
	}

	// public synchronized void show()  ************** bug in Symantec Cafe code generation!!!
	public void show()
	{
		Rectangle bounds = getParent().getBounds();
		Rectangle abounds = getBounds();

		setLocation(bounds.x + (bounds.width - abounds.width)/ 2,
			 bounds.y + (bounds.height - abounds.height)/2);

		super.show();
	}

	//{{DECLARE_CONTROLS
	java.awt.Label label1 = new java.awt.Label();
	java.awt.TextArea textArea1 = new java.awt.TextArea("",0,0,TextArea.SCROLLBARS_VERTICAL_ONLY);
	//}}

    // Used for addNotify redundency check.
	boolean fComponentsAdjusted = false;

	class SymWindow extends java.awt.event.WindowAdapter
	{
		public void windowClosing(java.awt.event.WindowEvent event)
		{
			Object object = event.getSource();
			if (object == AboutDialog.this)
				AboutDialog_WindowClosing(event);
		}
	}

	void AboutDialog_WindowClosing(java.awt.event.WindowEvent event)
	{
		hide();		    // hide the Frame
		dispose();	   	    // free the system resources
	}

}
