@Override
    public void drawShape(Graphics graphics) {
        int xn, yn, xm, ym;
        int xa, ya, xb, yb, xc, yc, xd, yd;

        // xn and yn is the first point the user clicked
        // xm and ym is the second point the user clicked
        xn = super.getXi();
        yn = super.getYi();
        xm = super.getXo();
        ym = super.getYo();

        graphics.setColor(super.getColor());

        int dx = xm - xn;
        int dy = ym - yn;

        // Scenario for slope less than 1.
        if (Math.abs(dx) > Math.abs(dy)) {
            if (xn > xm) {
                int tempX = xn;
                xn = xm;
                xm = tempX;

                int tempY = yn;
                yn = ym;
                ym = tempY;
            } else {
                xn = super.getXi();
                yn = super.getYi();
                xm = super.getXo();
                ym = super.getYo();
            }

            xa = xn;
            xb = xm;
            xc = xn;
            xd = xm;

            if (yn > ym) {
                ya = ym;
                yb = ym;
                yc = yn;
                yd = yn;

            } else {
                ya = yn;
                yb = yn;
                yc = ym;
                yd = ym;
            }

            // Scenario for slope is greater or equal to 1.
        } else {
            if (yn > ym) {
                int tempX = xn;
                xn = xm;
                xm = tempX;

                int tempY = yn;
                yn = ym;
                ym = tempY;
            } else {
                xn = super.getXi();
                yn = super.getYi();
                xm = super.getXo();
                ym = super.getYo();
            }

            ya = yn;
            yb = yn;
            yc = ym;
            yd = ym;

            if (xn > xm) {
                xa = xm;
                xb = xn;
                xc = xm;
                xd = xn;
            } else {
                xa = xn;
                xb = xm;
                xc = xn;
                xd = xm;
            }
        }

        this.drawTriangle(graphics, xa, ya, xb, yb, xc, yc, xd, yd);

    }