/*
 * @(#)BalancedBSTTreeJPanel.java
 *
 * Last Modified: 9/15/01
 */

/** * This class provides the panel for a <code>BalancedBSTTree</code>. It keeps the graphics for drawing
	* the tree and the image for redrawing.
	*
 	* @author  Corey Sanders
	* @version 1.1 9/15/01
 	*/
public class BalancedBSTTreeJPanel extends BSTTreeJPanel {

	/**
	 * Sole Constructor, setting the tree as a BalancedBSTTree.
	 */
    public BalancedBSTTreeJPanel() {
		super();
		setTree(new BalancedBSTTreeHead(BSTTree.ANIMATING_BST_TREE_TYPE));
    }


 	/**
 	 * Constructs an error type if the tree is attempted to balance.
 	 */
 	 protected void makeBalanceErrorMessage() {
		 String errorMsg = new String("Balanced BST trees are already\nbalanced(Hence the name).");

 		 messageAction(TreeMessageEvent.ERROR_MESSAGE, errorMsg.toString());

 	 }

	/**
	 * Balance command. No action.
	 *
	 * @param node Tree to balance.
	 */
	public void balanceCommand(Tree node) {
		makeBalanceErrorMessage();
	}

}

