/*
* Scrabaid
*
* Revisions:
*
* 18/05/2001 lc - v1.0 release
*
* ----------------------------------------------------------------------------
*
* Scrabaid version 1.0, Copyright 2001 Linus Chang
* Scrabaid comes with ABSOLUTELY NO WARRANTY; for details, view the LICENCE
* file included with this distribution. This is free software, and you are
* welcome to redistribute it under certain conditions; view the LICENCE
* file for details.
*/

import java.awt.*;
import java.awt.event.*;


class WindowEventHandler extends WindowAdapter {
	public void windowClosing(WindowEvent e) {
		e.getWindow().setVisible(false);
	}
}

class HelpDeveloperFrame extends Frame {
	static String []disclaimer = 
		{ "Scrabaid version 1.0, Copyright 2001 Linus Chang",
		"Scrabaid comes with ABSOLUTELY NO WARRANTY; for details, view the LICENCE",
		"file included with this distribution. This is free software, and you are welcome to",
		"redistribute it under certain conditions; view the LICENCE file for details." };

	static String [] developerHelp =
		{ "Refer to the Scrabaid home page for details, at http://scrabaid.sourceforge.net" };

	static Panel SetupPanel(String []message, Color color) {
		Panel p = new Panel();
		GridBagLayout gbl = new GridBagLayout();
		p.setLayout(gbl);
		for (int c = 0; c < message.length; c++) {
			Label l = new Label(message[c]);
			GridBagConstraints constraints = new GridBagConstraints();
			constraints.gridx = 0;
			constraints.gridy = c;
			constraints.fill = GridBagConstraints.NONE;
			constraints.anchor = GridBagConstraints.WEST;
			l.setForeground(color);
			if (c == 0) {
				constraints.insets.top = 20;
				constraints.insets.left = 5;
			}
			else {
				constraints.insets.left = 15;
				constraints.insets.top = 0;
				constraints.insets.bottom = 0;
				constraints.ipady = 0;
			}
			gbl.setConstraints(l,constraints);
			p.add(l);
		}
		return p;

	}
	HelpDeveloperFrame() {
		super("Scrabaid Help - Developer Information");
		setResizable(false);
		add("North", new ScrabaidHeading());
		add("Center", SetupPanel(developerHelp, new Color(0.3f,0.0f,0.0f)));
		add("South", SetupPanel(disclaimer, new Color(0.1f,0.0f,0.5f)));
		addWindowListener(new WindowEventHandler());
		pack();
	}
}
class HelpHelpFrame extends Frame {
	static String [] help =
		{ "Scrabaid is straightforward to use:",
		"- To make changes to the board or your tray, click the \"Change board\" button and type in",
		"    letters into the board and tray. Click the \"Finish changes\" button when done.",
		"- To search for possible moves, click the \"Find all matches\" button.",
		"- To accept a suggestion, highlight the suggestion and click the \"Accept suggestion\" button."
		};
	HelpHelpFrame() {
		super("Scrabaid Help");
		setResizable(false);
		add("North", new ScrabaidHeading());
		add("Center", HelpDeveloperFrame.SetupPanel(help, new Color(0.3f,0.0f,0.0f)));
		add("South", HelpDeveloperFrame.SetupPanel(HelpDeveloperFrame.disclaimer, new Color(0.1f,0.0f,0.5f)));
		addWindowListener(new WindowEventHandler());
		pack();
	}
}



