/*
		A basic implementation of the JDialog class.
*/

import java.awt.*;
import javax.swing.*;

public class JAboutDialog extends javax.swing.JDialog
{
	public JAboutDialog(Frame parentFrame)
	{
		super(parentFrame);
		// 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
		setTitle("About JTextPrinterTestApplication");
		setModal(true);
		getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER,5,5));
		getContentPane().setBackground(new java.awt.Color(223,223,223));
		setSize(413,432);
		setVisible(false);
		JTextAreaSpacer.setText("   ");
		JTextAreaSpacer.setSelectionColor(new java.awt.Color(204,204,255));
		JTextAreaSpacer.setLineWrap(true);
		JTextAreaSpacer.setWrapStyleWord(true);
		getContentPane().add(JTextAreaSpacer);
		JTextAreaSpacer.setBackground(new java.awt.Color(223,223,223));
		JTextAreaSpacer.setFont(new Font("SansSerif", Font.BOLD, 14));
		JTextAreaSpacer.setBounds(-2,5,417,20);
		JTextArea4.setText("JTextPrinterTestApplication");
		JTextArea4.setSelectionColor(new java.awt.Color(204,204,255));
		JTextArea4.setLineWrap(true);
		JTextArea4.setWrapStyleWord(true);
		getContentPane().add(JTextArea4);
		JTextArea4.setBackground(new java.awt.Color(223,223,223));
		JTextArea4.setFont(new Font("SansSerif", Font.BOLD, 14));
		JTextArea4.setBounds(-2,30,417,20);
		JTextArea3.setText("(C) Copyright 1999, Wildcrest Associates, All rights reserved..");
		JTextArea3.setSelectionColor(new java.awt.Color(204,204,255));
		JTextArea3.setLineWrap(true);
		JTextArea3.setWrapStyleWord(true);
		getContentPane().add(JTextArea3);
		JTextArea3.setBackground(new java.awt.Color(223,223,223));
		JTextArea3.setFont(new Font("SansSerif", Font.PLAIN, 12));
		JTextArea3.setBounds(-2,55,417,19);
		JTextArea2.setText("Test application for printing multipage formatted rich text documents.  Compose and print rich text documents including embedded graphics.  Save and reopen documents as .SSD (serialized StyledDocument) files.  Can also open and edit .RTF or .HTML files (import and printing quality limited in earlier Java releases).  All other extensions open as plain text files.  Use page setup dialog to change printing parameters.  To purchase JTextPrinter, please visit the Wildcrest Associates web site at http://www.wildcrest.com");
		JTextArea2.setSelectionColor(new java.awt.Color(204,204,255));
		JTextArea2.setLineWrap(true);
		JTextArea2.setWrapStyleWord(true);
		getContentPane().add(JTextArea2);
		JTextArea2.setBackground(new java.awt.Color(223,223,223));
		JTextArea2.setFont(new Font("Serif", Font.PLAIN, 13));
		JTextArea2.setBounds(-2,79,417,116);
		JTextArea1.setText("LICENSE and CONDITIONS OF USE - The source code for this application may be freely used, modified, incorporated, and distributed without restriction as part of any software that uses JTextPrinter by Wildcrest Associates.  This software is provided \"as is\" with no representations or warranties of any kind.  Use at your own risk, no liability of any kind is assumed.  Please send any feature requests, bug reports, or questions to products@wildcrest.com");
		JTextArea1.setSelectionColor(new java.awt.Color(204,204,255));
		JTextArea1.setLineWrap(true);
		JTextArea1.setWrapStyleWord(true);
		getContentPane().add(JTextArea1);
		JTextArea1.setBackground(new java.awt.Color(223,223,223));
		JTextArea1.setFont(new Font("Serif", Font.PLAIN, 11));
		JTextArea1.setBounds(-2,200,417,88);
		JPanelOK.setLayout(new FlowLayout(FlowLayout.CENTER,5,5));
		getContentPane().add(JPanelOK);
		JPanelOK.setBackground(new java.awt.Color(223,223,223));
		JPanelOK.setBounds(176,293,61,35);
		okButton.setText("OK");
		okButton.setActionCommand("OK");
		okButton.setAlignmentX(0.5F);
		okButton.setMnemonic((int)'O');
		JPanelOK.add(okButton);
		okButton.setBackground(java.awt.Color.lightGray);
		okButton.setBounds(5,5,51,25);
		//}}		

		//{{REGISTER_LISTENERS
		SymWindow aSymWindow = new SymWindow();
		this.addWindowListener(aSymWindow);
		SymAction lSymAction = new SymAction();
		okButton.addActionListener(lSymAction);
		//}}
		
		JTextAreaSpacer.setBorder(BorderFactory.createEmptyBorder());
		JTextArea1.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
		JTextArea2.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
		JTextArea3.setBorder(BorderFactory.createEmptyBorder(0,20,0,0));
		JTextArea4.setBorder(BorderFactory.createEmptyBorder(0,20,0,0));
    }
    
	public void setVisible(boolean b)
	{
	    if (b)
	    {
    		Rectangle bounds = (getParent()).getBounds();
    		Dimension size = getSize();
    		setLocation(bounds.x + (bounds.width - size.width)/2,
    			        bounds.y + (bounds.height - size.height)/2);
	    }

		super.setVisible(b);
	}

	public void addNotify()
	{
		// Record the size of the window prior to calling parents addNotify.
		Dimension d = getSize();

		super.addNotify();

		if (fComponentsAdjusted)
			return;
		// Adjust components according to the insets
		Insets insets = getInsets();
		setSize(insets.left + insets.right + d.width, insets.top + insets.bottom + d.height);
		Component components[] = getContentPane().getComponents();
		for (int i = 0; i < components.length; i++)
		{
			Point p = components[i].getLocation();
			p.translate(insets.left, insets.top);
			components[i].setLocation(p);
		}
		fComponentsAdjusted = true;
	}

	// Used for addNotify check.
	boolean fComponentsAdjusted = false;

	//{{DECLARE_CONTROLS
	javax.swing.JTextArea JTextAreaSpacer = new javax.swing.JTextArea();
	javax.swing.JTextArea JTextArea4 = new javax.swing.JTextArea();
	javax.swing.JTextArea JTextArea3 = new javax.swing.JTextArea();
	javax.swing.JTextArea JTextArea2 = new javax.swing.JTextArea();
	javax.swing.JTextArea JTextArea1 = new javax.swing.JTextArea();
	javax.swing.JPanel JPanelOK = new javax.swing.JPanel();
	javax.swing.JButton okButton = new javax.swing.JButton();
	//}}

	class SymWindow extends java.awt.event.WindowAdapter
	{
		public void windowClosing(java.awt.event.WindowEvent event)
		{
			Object object = event.getSource();
			if (object == JAboutDialog.this)
				jAboutDialog_windowClosing(event);
		}
	}

	void jAboutDialog_windowClosing(java.awt.event.WindowEvent event)
	{
		// to do: code goes here.
			 
		jAboutDialog_windowClosing_Interaction1(event);
	}

	void jAboutDialog_windowClosing_Interaction1(java.awt.event.WindowEvent event) {
		try {
			// JAboutDialog Hide the JAboutDialog
			this.setVisible(false);
		} catch (Exception e) {
		}
	}
	
	class SymAction implements java.awt.event.ActionListener
	{
		public void actionPerformed(java.awt.event.ActionEvent event)
		{
			Object object = event.getSource();
			if (object == okButton)
				okButton_actionPerformed(event);
		}
	}

	void okButton_actionPerformed(java.awt.event.ActionEvent event)
	{
		// to do: code goes here.
			 
		okButton_actionPerformed_Interaction1(event);
	}

	void okButton_actionPerformed_Interaction1(java.awt.event.ActionEvent event) {
		try {
			// JAboutDialog Hide the JAboutDialog
			this.setVisible(false);
		} catch (Exception e) {
		}
	}
}