/*
		A basic implementation of the JDialog class.
*/

import java.awt.*;
import com.sun.java.swing.*;
import com.wildcrest.JTextPrinter;

public class JPageSetupDialog extends com.sun.java.swing.JDialog
{
	public JPageSetupDialog(Frame parent)
	{
		super(parent);
		
		// 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
		setModal(false);
		setDefaultCloseOperation(com.sun.java.swing.JFrame.HIDE_ON_CLOSE);
		getContentPane().setLayout(new BorderLayout(20,20));
		getContentPane().setBackground(new java.awt.Color(223,223,223));
		setSize(450,642);
		setVisible(false);
		JPanelAll.setLayout(new BoxLayout(JPanelAll,BoxLayout.Y_AXIS));
		getContentPane().add("Center",JPanelAll);
		JPanelAll.setBackground(new java.awt.Color(223,223,223));
		JPanelAll.setBounds(0,0,374,642);
		JPanelLeftHeader.setAlignmentY(0.473684F);
		JPanelLeftHeader.setLayout(new BoxLayout(JPanelLeftHeader,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelLeftHeader);
		JPanelLeftHeader.setBackground(new java.awt.Color(223,223,223));
		JPanelLeftHeader.setBounds(0,0,374,19);
		JLabelLeftHeader.setText("Left header:  ");
		JPanelLeftHeader.add(JLabelLeftHeader);
		JLabelLeftHeader.setBounds(0,2,74,15);
		JPanelLeftHeader.add(JTextFieldLeftHeader);
		JTextFieldLeftHeader.setBounds(74,0,300,19);
		JPanelCenterHeader.setAlignmentY(0.473684F);
		JPanelCenterHeader.setLayout(new BoxLayout(JPanelCenterHeader,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelCenterHeader);
		JPanelCenterHeader.setBackground(new java.awt.Color(223,223,223));
		JPanelCenterHeader.setBounds(0,19,374,19);
		JLabelCenterHeader.setText("Center header:  ");
		JPanelCenterHeader.add(JLabelCenterHeader);
		JLabelCenterHeader.setBounds(0,2,90,15);
		JPanelCenterHeader.add(JTextFieldCenterHeader);
		JTextFieldCenterHeader.setBounds(90,0,284,19);
		JPanelRightHeader.setAlignmentY(0.473684F);
		JPanelRightHeader.setLayout(new BoxLayout(JPanelRightHeader,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelRightHeader);
		JPanelRightHeader.setBackground(new java.awt.Color(223,223,223));
		JPanelRightHeader.setBounds(0,38,374,19);
		JLabelRightHeader.setText("Right header:  ");
		JPanelRightHeader.add(JLabelRightHeader);
		JLabelRightHeader.setBounds(0,2,81,15);
		JPanelRightHeader.add(JTextFieldRightHeader);
		JTextFieldRightHeader.setBounds(81,0,293,19);
		JLabelSpacer0.setText("    ");
		JPanelAll.add(JLabelSpacer0);
		JLabelSpacer0.setBackground(new java.awt.Color(223,223,223));
		JLabelSpacer0.setBounds(187,57,12,15);
		JPanelLeftFooter.setAlignmentY(0.473684F);
		JPanelLeftFooter.setLayout(new BoxLayout(JPanelLeftFooter,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelLeftFooter);
		JPanelLeftFooter.setBackground(new java.awt.Color(223,223,223));
		JPanelLeftFooter.setBounds(0,72,374,19);
		JLabelLeftFooter.setText("Left footer:  ");
		JPanelLeftFooter.add(JLabelLeftFooter);
		JLabelLeftFooter.setBounds(0,2,68,15);
		JPanelLeftFooter.add(JTextFieldLeftFooter);
		JTextFieldLeftFooter.setBounds(68,0,306,19);
		JPanelCenterFooter.setAlignmentY(0.473684F);
		JPanelCenterFooter.setLayout(new BoxLayout(JPanelCenterFooter,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelCenterFooter);
		JPanelCenterFooter.setBackground(new java.awt.Color(223,223,223));
		JPanelCenterFooter.setBounds(0,91,374,19);
		JLabelCenterFooter.setText("Center footer:  ");
		JPanelCenterFooter.add(JLabelCenterFooter);
		JLabelCenterFooter.setBounds(0,2,84,15);
		JPanelCenterFooter.add(JTextFieldCenterFooter);
		JTextFieldCenterFooter.setBounds(84,0,290,19);
		JPanelRightFooter.setAlignmentY(0.473684F);
		JPanelRightFooter.setLayout(new BoxLayout(JPanelRightFooter,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelRightFooter);
		JPanelRightFooter.setBackground(new java.awt.Color(223,223,223));
		JPanelRightFooter.setBounds(0,110,374,19);
		JLabelRightFooter.setText("Right footer:  ");
		JPanelRightFooter.add(JLabelRightFooter);
		JLabelRightFooter.setBounds(0,2,75,15);
		JPanelRightFooter.add(JTextFieldRightFooter);
		JTextFieldRightFooter.setBounds(75,0,299,19);
		JLabelSpacer1.setText("    ");
		JPanelAll.add(JLabelSpacer1);
		JLabelSpacer1.setBackground(new java.awt.Color(223,223,223));
		JLabelSpacer1.setBounds(187,129,12,15);
		JPanelHeaderFooterFont.setAlignmentY(0.473684F);
		JPanelHeaderFooterFont.setLayout(new BoxLayout(JPanelHeaderFooterFont,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelHeaderFooterFont);
		JPanelHeaderFooterFont.setBackground(new java.awt.Color(223,223,223));
		JPanelHeaderFooterFont.setBounds(0,144,374,19);
		JLabelHeaderFooterFont.setText("Header/footer font:  ");
		JPanelHeaderFooterFont.add(JLabelHeaderFooterFont);
		JLabelHeaderFooterFont.setBounds(0,2,112,15);
		JPanelHeaderFooterFont.add(JTextFieldHeaderFooterFont);
		JTextFieldHeaderFooterFont.setBounds(112,0,262,19);
		JLabelSpacer2.setText("    ");
		JPanelAll.add(JLabelSpacer2);
		JLabelSpacer2.setBackground(new java.awt.Color(223,223,223));
		JLabelSpacer2.setBounds(187,163,12,15);
		JPanelGapBelowHeader.setAlignmentY(0.473684F);
		JPanelGapBelowHeader.setLayout(new BoxLayout(JPanelGapBelowHeader,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelGapBelowHeader);
		JPanelGapBelowHeader.setBackground(new java.awt.Color(223,223,223));
		JPanelGapBelowHeader.setBounds(0,178,374,19);
		JLabelGapBelowHeader.setText("Gap below header:  ");
		JPanelGapBelowHeader.add(JLabelGapBelowHeader);
		JLabelGapBelowHeader.setBackground(new java.awt.Color(223,223,223));
		JLabelGapBelowHeader.setBounds(0,2,111,15);
		JPanelGapBelowHeader.add(JTextFieldGapBelowHeader);
		JTextFieldGapBelowHeader.setBounds(111,0,263,19);
		JPanelGapAboveFooter.setAlignmentY(0.473684F);
		JPanelGapAboveFooter.setLayout(new BoxLayout(JPanelGapAboveFooter,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelGapAboveFooter);
		JPanelGapAboveFooter.setBackground(new java.awt.Color(223,223,223));
		JPanelGapAboveFooter.setBounds(0,197,374,19);
		JLabelGapAboveFooter.setText("Gap above footer:  ");
		JPanelGapAboveFooter.add(JLabelGapAboveFooter);
		JLabelGapAboveFooter.setBackground(new java.awt.Color(223,223,223));
		JLabelGapAboveFooter.setBounds(0,2,105,15);
		JPanelGapAboveFooter.add(JTextFieldGapAboveFooter);
		JTextFieldGapAboveFooter.setBounds(105,0,269,19);
		JPanelLinesBoxes.setLayout(new GridLayout(1,1,0,0));
		JPanelAll.add(JPanelLinesBoxes);
		JPanelLinesBoxes.setBackground(new java.awt.Color(223,223,223));
		JPanelLinesBoxes.setBounds(0,216,374,92);
		JPanelLines.setAlignmentY(0.473684F);
		JPanelLines.setLayout(new GridLayout(2,1,0,0));
		JPanelLinesBoxes.add(JPanelLines);
		JPanelLines.setBackground(new java.awt.Color(223,223,223));
		JPanelLines.setBounds(0,0,187,92);
		JCheckBoxLineBelowHeader.setText("Line below header");
		JCheckBoxLineBelowHeader.setActionCommand("Line below header");
		JPanelLines.add(JCheckBoxLineBelowHeader);
		JCheckBoxLineBelowHeader.setBackground(new java.awt.Color(223,223,223));
		JCheckBoxLineBelowHeader.setForeground(new java.awt.Color(102,102,153));
		JCheckBoxLineBelowHeader.setBounds(0,0,187,46);
		JCheckBoxLineAboveFooter.setText("Line above footer");
		JCheckBoxLineAboveFooter.setActionCommand("Line above footer");
		JPanelLines.add(JCheckBoxLineAboveFooter);
		JCheckBoxLineAboveFooter.setBackground(new java.awt.Color(223,223,223));
		JCheckBoxLineAboveFooter.setForeground(new java.awt.Color(102,102,153));
		JCheckBoxLineAboveFooter.setBounds(0,46,187,46);
		JPanelBoxes.setAlignmentY(0.473684F);
		JPanelBoxes.setLayout(new GridLayout(2,1,0,0));
		JPanelLinesBoxes.add(JPanelBoxes);
		JPanelBoxes.setBackground(new java.awt.Color(223,223,223));
		JPanelBoxes.setBounds(187,0,187,92);
		JCheckBoxAroundHeader.setText("Box around header");
		JCheckBoxAroundHeader.setActionCommand("Box around header");
		JPanelBoxes.add(JCheckBoxAroundHeader);
		JCheckBoxAroundHeader.setBackground(new java.awt.Color(223,223,223));
		JCheckBoxAroundHeader.setForeground(new java.awt.Color(102,102,153));
		JCheckBoxAroundHeader.setBounds(0,0,187,46);
		JCheckBoxAroundFooter.setText("Box around footer");
		JCheckBoxAroundFooter.setActionCommand("Box around footer");
		JPanelBoxes.add(JCheckBoxAroundFooter);
		JCheckBoxAroundFooter.setBackground(new java.awt.Color(223,223,223));
		JCheckBoxAroundFooter.setForeground(new java.awt.Color(102,102,153));
		JCheckBoxAroundFooter.setBounds(0,46,187,46);
		JLabelSpacer3.setText("    ");
		JPanelAll.add(JLabelSpacer3);
		JLabelSpacer3.setBackground(new java.awt.Color(223,223,223));
		JLabelSpacer3.setBounds(187,308,12,15);
		JPanelLeftMargin.setAlignmentY(0.473684F);
		JPanelLeftMargin.setLayout(new BoxLayout(JPanelLeftMargin,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelLeftMargin);
		JPanelLeftMargin.setBackground(new java.awt.Color(223,223,223));
		JPanelLeftMargin.setBounds(0,323,374,19);
		JLabelLeftMargin.setText("Left margin:  ");
		JPanelLeftMargin.add(JLabelLeftMargin);
		JLabelLeftMargin.setBackground(new java.awt.Color(223,223,223));
		JLabelLeftMargin.setBounds(0,2,74,15);
		JPanelLeftMargin.add(JTextFieldLeftMargin);
		JTextFieldLeftMargin.setBounds(74,0,300,19);
		JPanelRightMargin.setAlignmentY(0.473684F);
		JPanelRightMargin.setLayout(new BoxLayout(JPanelRightMargin,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelRightMargin);
		JPanelRightMargin.setBackground(new java.awt.Color(223,223,223));
		JPanelRightMargin.setBounds(0,342,374,19);
		JLabelRightMargin.setText("Right margin:  ");
		JPanelRightMargin.add(JLabelRightMargin);
		JLabelRightMargin.setBackground(new java.awt.Color(223,223,223));
		JLabelRightMargin.setBounds(0,2,81,15);
		JPanelRightMargin.add(JTextFieldRightMargin);
		JTextFieldRightMargin.setBounds(81,0,293,19);
		JPanelTopMargin.setAlignmentY(0.473684F);
		JPanelTopMargin.setLayout(new BoxLayout(JPanelTopMargin,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelTopMargin);
		JPanelTopMargin.setBackground(new java.awt.Color(223,223,223));
		JPanelTopMargin.setBounds(0,361,374,19);
		JLabelTopMargin.setText("Top margin:  ");
		JPanelTopMargin.add(JLabelTopMargin);
		JLabelTopMargin.setBackground(new java.awt.Color(223,223,223));
		JLabelTopMargin.setBounds(0,2,73,15);
		JPanelTopMargin.add(JTextFieldTopMargin);
		JTextFieldTopMargin.setBounds(73,0,301,19);
		JPanelBottomMargin.setAlignmentY(0.473684F);
		JPanelBottomMargin.setLayout(new BoxLayout(JPanelBottomMargin,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelBottomMargin);
		JPanelBottomMargin.setBackground(new java.awt.Color(223,223,223));
		JPanelBottomMargin.setBounds(0,380,374,19);
		JLabelBottomMargin.setText("Bottom margin:  ");
		JPanelBottomMargin.add(JLabelBottomMargin);
		JLabelBottomMargin.setBackground(new java.awt.Color(223,223,223));
		JLabelBottomMargin.setBounds(0,2,93,15);
		JPanelBottomMargin.add(JTextFieldBottomMargin);
		JTextFieldBottomMargin.setBounds(93,0,281,19);
		JLabelSpacer4.setText("    ");
		JPanelAll.add(JLabelSpacer4);
		JLabelSpacer4.setBackground(new java.awt.Color(223,223,223));
		JLabelSpacer4.setBounds(187,399,12,15);
		JPanelNumberOfColumns.setAlignmentY(0.473684F);
		JPanelNumberOfColumns.setLayout(new BoxLayout(JPanelNumberOfColumns,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelNumberOfColumns);
		JPanelNumberOfColumns.setBackground(new java.awt.Color(223,223,223));
		JPanelNumberOfColumns.setBounds(0,414,374,19);
		JLabelNumberOfColumns.setText("Number of columns:  ");
		JPanelNumberOfColumns.add(JLabelNumberOfColumns);
		JLabelNumberOfColumns.setBackground(new java.awt.Color(223,223,223));
		JLabelNumberOfColumns.setBounds(0,2,120,15);
		JPanelNumberOfColumns.add(JTextFieldNumberOfColumns);
		JTextFieldNumberOfColumns.setBounds(120,0,254,19);
		JPanelGapBetweenColumns.setAlignmentY(0.473684F);
		JPanelGapBetweenColumns.setLayout(new BoxLayout(JPanelGapBetweenColumns,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelGapBetweenColumns);
		JPanelGapBetweenColumns.setBackground(new java.awt.Color(223,223,223));
		JPanelGapBetweenColumns.setBounds(0,433,374,19);
		JLabelGapBetweenColumns.setText("Gap between columns:  ");
		JPanelGapBetweenColumns.add(JLabelGapBetweenColumns);
		JLabelGapBetweenColumns.setBackground(new java.awt.Color(223,223,223));
		JLabelGapBetweenColumns.setForeground(new java.awt.Color(102,102,153));
		JLabelGapBetweenColumns.setBounds(0,2,135,15);
		JPanelGapBetweenColumns.add(JTextFieldGapBetweenColumns);
		JTextFieldGapBetweenColumns.setBounds(135,0,239,19);
		JPanelMaximumColumnWidth.setAlignmentY(0.473684F);
		JPanelMaximumColumnWidth.setLayout(new BoxLayout(JPanelMaximumColumnWidth,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelMaximumColumnWidth);
		JPanelMaximumColumnWidth.setBackground(new java.awt.Color(223,223,223));
		JPanelMaximumColumnWidth.setBounds(0,452,374,19);
		JLabelMaximumColumnWidth.setText("Maximum column width:  ");
		JPanelMaximumColumnWidth.add(JLabelMaximumColumnWidth);
		JLabelMaximumColumnWidth.setBackground(new java.awt.Color(223,223,223));
		JLabelMaximumColumnWidth.setBounds(0,2,144,15);
		JPanelMaximumColumnWidth.add(JTextFieldMaximumColumnWidth);
		JTextFieldMaximumColumnWidth.setBounds(144,0,230,19);
		JLabelSpacer5.setText("    ");
		JPanelAll.add(JLabelSpacer5);
		JLabelSpacer5.setBackground(new java.awt.Color(223,223,223));
		JLabelSpacer5.setBounds(187,471,12,15);
		JPanelPageRange.setAlignmentY(0.473684F);
		JPanelPageRange.setLayout(new BoxLayout(JPanelPageRange,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelPageRange);
		JPanelPageRange.setBackground(new java.awt.Color(223,223,223));
		JPanelPageRange.setBounds(0,486,374,19);
		JLabelPageRange.setText("Page range:  ");
		JPanelPageRange.add(JLabelPageRange);
		JLabelPageRange.setBackground(new java.awt.Color(223,223,223));
		JLabelPageRange.setBounds(0,2,74,15);
		JPanelPageRange.add(JTextFieldPageRange);
		JTextFieldPageRange.setBounds(74,0,300,19);
		JPanelPrintJobName.setAlignmentY(0.473684F);
		JPanelPrintJobName.setLayout(new BoxLayout(JPanelPrintJobName,BoxLayout.X_AXIS));
		JPanelAll.add(JPanelPrintJobName);
		JPanelPrintJobName.setBackground(new java.awt.Color(223,223,223));
		JPanelPrintJobName.setBounds(0,505,374,19);
		JLabelPrintJobName.setText("Print job name:  ");
		JLabelPrintJobName.setOpaque(true);
		JPanelPrintJobName.add(JLabelPrintJobName);
		JLabelPrintJobName.setBackground(new java.awt.Color(223,223,223));
		JLabelPrintJobName.setBounds(0,2,91,15);
		JPanelPrintJobName.add(JTextFieldPrintJobName);
		JTextFieldPrintJobName.setBounds(91,0,283,19);
		JPanelOKCancel.setLayout(new FlowLayout(FlowLayout.CENTER,25,25));
		JPanelAll.add(JPanelOKCancel);
		JPanelOKCancel.setBackground(new java.awt.Color(223,223,223));
		JPanelOKCancel.setBounds(0,524,374,117);
		JButtonOK.setText("OK");
		JButtonOK.setActionCommand("OK");
		JPanelOKCancel.add(JButtonOK);
		JButtonOK.setBackground(java.awt.Color.lightGray);
		JButtonOK.setBounds(112,25,51,25);
		JButtonCancel.setText("Cancel");
		JButtonCancel.setActionCommand("Cancel");
		JPanelOKCancel.add(JButtonCancel);
		JButtonCancel.setBackground(java.awt.Color.lightGray);
		JButtonCancel.setBounds(188,25,73,25);
		//}}
	
		//{{REGISTER_LISTENERS
		SymAction lSymAction = new SymAction();
		JButtonCancel.addActionListener(lSymAction);
		JButtonOK.addActionListener(lSymAction);
		//}}
		
		JPanelAll.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
	}

    public JPageSetupDialog(JTextPrinter jtextprinter) {
        this();
        this.jtextprinter = jtextprinter;
        updatePageSetupDialog();
        }
        
	
	private void updatePageSetupDialog() {
	    if (jtextprinter!=null) {
	        JTextFieldLeftHeader.setText(jtextprinter.getLeftHeader());
	        JTextFieldCenterHeader.setText(jtextprinter.getCenterHeader());
	        JTextFieldRightHeader.setText(jtextprinter.getRightHeader());
	        JTextFieldLeftFooter.setText(jtextprinter.getLeftFooter());
	        JTextFieldCenterFooter.setText(jtextprinter.getCenterFooter());
	        JTextFieldRightFooter.setText(jtextprinter.getRightFooter());
	        JTextFieldHeaderFooterFont.setText(font2String(jtextprinter.getHeaderFooterFont()));
	        JTextFieldGapBelowHeader.setText(Double.toString(jtextprinter.getGapBelowHeader()));
	        JTextFieldGapAboveFooter.setText(Double.toString(jtextprinter.getGapAboveFooter()));
	        JCheckBoxLineBelowHeader.setSelected(jtextprinter.isLineBelowHeader());
	        JCheckBoxLineAboveFooter.setSelected(jtextprinter.isLineAboveFooter());
	        JCheckBoxAroundHeader.setSelected(jtextprinter.isBoxAroundHeader());
	        JCheckBoxAroundFooter.setSelected(jtextprinter.isBoxAroundFooter());
	        JTextFieldLeftMargin.setText(Double.toString(jtextprinter.getLeftMargin()));
	        JTextFieldRightMargin.setText(Double.toString(jtextprinter.getRightMargin()));
	        JTextFieldTopMargin.setText(Double.toString(jtextprinter.getTopMargin()));
	        JTextFieldBottomMargin.setText(Double.toString(jtextprinter.getBottomMargin()));
	        JTextFieldNumberOfColumns.setText(Integer.toString(jtextprinter.getNumberOfColumns()));
	        JTextFieldGapBetweenColumns.setText(Double.toString(jtextprinter.getGapBetweenColumns()));
	        JTextFieldMaximumColumnWidth.setText(Integer.toString(jtextprinter.getMaximumColumnWidth()));
	        JTextFieldPageRange.setText(jtextprinter.getPageRange());
	        JTextFieldPrintJobName.setText(jtextprinter.getPrintJobName());
	    }
	}
	
	private String font2String(Font f) {
	    int style = f.getStyle();
	    String styleName = "PLAIN";
		if (style==Font.BOLD) styleName = "BOLD";
		if (style==Font.ITALIC) styleName = "ITALIC";		
		return f.getFamily() + "," + styleName + "," + f.getSize();
	}
        
        
	public JPageSetupDialog()
	{
		this((Frame)null);
	}

	public JPageSetupDialog(String sTitle)
	{
		this();
		setTitle(sTitle);
	}

	public void setVisible(boolean b)
	{
        updatePageSetupDialog();
		if (b)
			setLocation(50, 50);
		super.setVisible(b);
		
	}

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

	public void addNotify()
	{
		// Record the size of the window prior to calling parents addNotify.
		Dimension size = getSize();

		super.addNotify();

		if (frameSizeAdjusted)
			return;
		frameSizeAdjusted = true;

		// Adjust size of frame according to the insets
		Insets insets = getInsets();
		setSize(insets.left + insets.right + size.width, insets.top + insets.bottom + size.height);
	}

	// Used by addNotify
	boolean frameSizeAdjusted = false;

	//{{DECLARE_CONTROLS
	com.sun.java.swing.JPanel JPanelAll = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JPanel JPanelLeftHeader = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelLeftHeader = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldLeftHeader = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JPanel JPanelCenterHeader = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelCenterHeader = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldCenterHeader = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JPanel JPanelRightHeader = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelRightHeader = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldRightHeader = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JLabel JLabelSpacer0 = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JPanel JPanelLeftFooter = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelLeftFooter = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldLeftFooter = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JPanel JPanelCenterFooter = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelCenterFooter = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldCenterFooter = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JPanel JPanelRightFooter = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelRightFooter = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldRightFooter = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JLabel JLabelSpacer1 = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JPanel JPanelHeaderFooterFont = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelHeaderFooterFont = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldHeaderFooterFont = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JLabel JLabelSpacer2 = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JPanel JPanelGapBelowHeader = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelGapBelowHeader = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldGapBelowHeader = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JPanel JPanelGapAboveFooter = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelGapAboveFooter = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldGapAboveFooter = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JPanel JPanelLinesBoxes = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JPanel JPanelLines = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JCheckBox JCheckBoxLineBelowHeader = new com.sun.java.swing.JCheckBox();
	com.sun.java.swing.JCheckBox JCheckBoxLineAboveFooter = new com.sun.java.swing.JCheckBox();
	com.sun.java.swing.JPanel JPanelBoxes = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JCheckBox JCheckBoxAroundHeader = new com.sun.java.swing.JCheckBox();
	com.sun.java.swing.JCheckBox JCheckBoxAroundFooter = new com.sun.java.swing.JCheckBox();
	com.sun.java.swing.JLabel JLabelSpacer3 = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JPanel JPanelLeftMargin = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelLeftMargin = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldLeftMargin = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JPanel JPanelRightMargin = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelRightMargin = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldRightMargin = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JPanel JPanelTopMargin = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelTopMargin = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldTopMargin = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JPanel JPanelBottomMargin = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelBottomMargin = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldBottomMargin = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JLabel JLabelSpacer4 = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JPanel JPanelNumberOfColumns = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelNumberOfColumns = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldNumberOfColumns = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JPanel JPanelGapBetweenColumns = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelGapBetweenColumns = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldGapBetweenColumns = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JPanel JPanelMaximumColumnWidth = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelMaximumColumnWidth = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldMaximumColumnWidth = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JLabel JLabelSpacer5 = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JPanel JPanelPageRange = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelPageRange = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldPageRange = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JPanel JPanelPrintJobName = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JLabel JLabelPrintJobName = new com.sun.java.swing.JLabel();
	com.sun.java.swing.JTextField JTextFieldPrintJobName = new com.sun.java.swing.JTextField();
	com.sun.java.swing.JPanel JPanelOKCancel = new com.sun.java.swing.JPanel();
	com.sun.java.swing.JButton JButtonOK = new com.sun.java.swing.JButton();
	com.sun.java.swing.JButton JButtonCancel = new com.sun.java.swing.JButton();
	//}}
	
	static JTextPrinter jtextprinter;


	class SymAction implements java.awt.event.ActionListener
	{
		public void actionPerformed(java.awt.event.ActionEvent event)
		{
			Object object = event.getSource();
			if (object == JButtonCancel)
				JButtonCancel_actionPerformed(event);
			else if (object == JButtonOK)
				JButtonOK_actionPerformed(event);
		}
	}

	void JButtonCancel_actionPerformed(java.awt.event.ActionEvent event)
	{
		// to do: code goes here.
			 
		JButtonCancel_actionPerformed_Interaction1(event);
	}

	void JButtonCancel_actionPerformed_Interaction1(java.awt.event.ActionEvent event)
	{
		try {
			// JPageSetupDialog Hide the JPageSetupDialog
			this.setVisible(false);
		} catch (Exception e) {
		}
	}

	void JButtonOK_actionPerformed(java.awt.event.ActionEvent event)
	{
		// to do: code goes here.
			 
		JButtonOK_actionPerformed_Interaction1(event);
	}

	void JButtonOK_actionPerformed_Interaction1(java.awt.event.ActionEvent event)
	{
	    updateJTextPrinter();
		try {
			// JPageSetupDialog Hide the JPageSetupDialog
			this.setVisible(false);
		} catch (Exception e) {
		}
	}
	
	private void updateJTextPrinter() {
	    if (jtextprinter!=null) {
	        jtextprinter.setLeftHeader(JTextFieldLeftHeader.getText());
	        jtextprinter.setCenterHeader(JTextFieldCenterHeader.getText());
	        jtextprinter.setRightHeader(JTextFieldRightHeader.getText());
	        jtextprinter.setLeftFooter(JTextFieldLeftFooter.getText());
	        jtextprinter.setCenterFooter(JTextFieldCenterFooter.getText());
	        jtextprinter.setRightFooter(JTextFieldRightFooter.getText());
	        jtextprinter.setHeaderFooterFont(string2Font(JTextFieldHeaderFooterFont.getText()));
	        jtextprinter.setGapBelowHeader(Double.valueOf(JTextFieldGapBelowHeader.getText()).doubleValue());
	        jtextprinter.setGapAboveFooter(Double.valueOf(JTextFieldGapAboveFooter.getText()).doubleValue());
	        jtextprinter.setLineBelowHeader(JCheckBoxLineBelowHeader.isSelected());
	        jtextprinter.setLineAboveFooter(JCheckBoxLineAboveFooter.isSelected());
	        jtextprinter.setBoxAroundHeader(JCheckBoxAroundHeader.isSelected());
	        jtextprinter.setBoxAroundFooter(JCheckBoxAroundFooter.isSelected());
	        jtextprinter.setLeftMargin(Double.valueOf(JTextFieldLeftMargin.getText()).doubleValue());
	        jtextprinter.setRightMargin(Double.valueOf(JTextFieldRightMargin.getText()).doubleValue());
	        jtextprinter.setTopMargin(Double.valueOf(JTextFieldTopMargin.getText()).doubleValue());
	        jtextprinter.setBottomMargin(Double.valueOf(JTextFieldBottomMargin.getText()).doubleValue());
	        jtextprinter.setNumberOfColumns(Integer.valueOf(JTextFieldNumberOfColumns.getText()).intValue());
	        jtextprinter.setGapBetweenColumns(Double.valueOf(JTextFieldGapBetweenColumns.getText()).doubleValue());
	        jtextprinter.setMaximumColumnWidth(Integer.valueOf(JTextFieldMaximumColumnWidth.getText()).intValue());
	        jtextprinter.setPageRange(JTextFieldPageRange.getText());
	        jtextprinter.setPrintJobName(JTextFieldPrintJobName.getText());
	    }
	}
	

	private Font string2Font(String s) {
		int firstcomma = s.indexOf(",");
		int lastcomma = s.lastIndexOf(",");
		String font = s.substring(0,firstcomma);
		String stylename = s.substring(firstcomma+1,lastcomma);
		int style=Font.PLAIN;
		if (stylename.equals("BOLD")) style=Font.BOLD;
		if (stylename.equals("ITALIC")) style=Font.ITALIC;
		int size = Integer.valueOf(s.substring(lastcomma+1)).intValue();
		return new Font(font,style,size);
	}
	
}