private void addPanelToTree(String name, int depth) {
		DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(name);
		
		if (depth > lastNodeDepth) {
			lastNode.add(newNode);
		} else if (depth == lastNodeDepth) {
			((DefaultMutableTreeNode) lastNode.getParent()).add(newNode);
		} else {
			int depthDifference = lastNodeDepth - depth;
			
			TreeNode parent = lastNode.getParent();
			for (int i = 0; i < depthDifference; i++) {
				parent = parent.getParent();
			}
			
			((DefaultMutableTreeNode) parent).add(newNode);
		}
		
		treeModel.reload();

		lastNode = newNode;
		lastNodeDepth = depth;
	}