//Main class class Node{ protected String name; protected Node left; protected Node right; protected int x; protected int y; protected int height; protected int width; //Constructor public Node(){ name=""; right=null; left=null; } //Similar constructor with various parameters being passed to them can be //constructed similarly. //Function which checks if the node is a leaf node or not public boolean isLeaf() { if(right==null&&left==null) return true; else return false; } //Function to set the name of the Node public void setName(String o){ name=o; } //Function to set the top left x coordinate of the rectangle public void setX(int i) { x=i; } //Function to set the top left y coordinate of the rectangle public void setY(int i) { y=i; } //Similar function to set the width and height of the rectangle //Function to get Right Child public Node getRight(){ return right; } //Function to get Left Child public Node getLeft(){ return left; } } //Use this type of class to draw rectangles.It stores the address of the rectangle in //a linked list class Rect { protected Rect Next; protected Node Add; //Constructor public Rect() { Next=null; Add=null; } //Constructor public Rect(Node i) { Next=null; Add=i; } //Function to get Address of the Rectangle in the tree public Node getAdd() { return Add; } //Function to get the address of next rectangle and etc. } //Write the applet to draw the rectangles here.