@Override
	public void paint(Graphics2D g, int width, int height) {
		double dividerPercentage = getCaseWidth(g) / (double) getLabelledWidth(g);
		int divider = (int) (width * dividerPercentage);
		int titleHeight = getTitleHeight(g);
		g.drawRect(0, 0, width, height);
		g.drawLine(0, 0, divider, titleHeight);
		g.drawLine(divider, titleHeight, width, 0);
		if (defaultLabelled != null) {
			int offset = (int) ((double) divider / width * expression.getWidth(g));
			expression.paint(g, divider - offset, 5);
		} else {
			expression.paint(g, width - expression.getWidth(g) - 10, 5);
		}
		int labelHeight = 5 + expression.getHeight(g) + 5;
		int offset = 0;
		for (int i = 0; i < cases.size(); i++) {
			Labelled caseLabelled = cases.get(i);
			int caseWidth;
			if (i != cases.size() - 1) {
				double casePercentage = caseLabelled.getWidth(g) / (double) getLabelledWidth(g);
				caseWidth = (int) (casePercentage * width);
			} else {
				caseWidth = divider - offset;
			}
			if (i != cases.size() - 1) {
				int lineOffset = (int) (titleHeight * ((offset + caseWidth) / (double) divider));
				g.drawLine(offset + caseWidth, lineOffset, offset + caseWidth, titleHeight);
			}
			g.translate(offset, titleHeight);
			Text label = caseLabelled.getLabel();
			label.paint(g, (caseWidth - label.getWidth(g)) / 2, -5 - label.getHeight(g));
			caseLabelled.getChild().paint(g, caseWidth, height - titleHeight);
			g.translate(-offset, -titleHeight);
			offset += caseWidth;
		}
		if (defaultLabelled != null) {
			int position = divider + (width - divider - defaultLabelled.getLabel().getWidth(g)) / 2;
			defaultLabelled.getLabel().paint(g, position, labelHeight);
			g.translate(divider, titleHeight);
			defaultLabelled.getChild().paint(g, width - divider, height - titleHeight);
			g.translate(-divider, -titleHeight);
		}
	}