//@author A0116538A

package bakatxt.gui;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Path2D;

import bakatxt.core.Task;

/**
 * This class dictates the color and shape of the box which the task will be put in.
 * This box is specifically for a top most box.
 *
 */
class FirstTaskBox extends TaskBox {

    public FirstTaskBox(Task task, Color backgroundColor) {
        super(task, backgroundColor);
    }

    @Override
    protected void paintComponent(Graphics g) {
        Graphics2D g2d = (Graphics2D) g.create();
        g2d.setColor(getBackground());
        g2d.setRenderingHints(UIHelper.antiAlias());
        g2d.fill(new TopRounded(getWidth(), getHeight()));
        g2d.dispose();
        super.paintComponent(g);
    }

    // TODO fix topRounded method
    class TopRounded extends Path2D.Double {

        public TopRounded(double width, double height) {
            moveTo(0, 0);
            lineTo(width, 0);
            lineTo(width, height - UIHelper.WINDOW_ROUNDNESS);
            curveTo(width, height, width, height, width - UIHelper.WINDOW_ROUNDNESS, height);
            lineTo(UIHelper.WINDOW_ROUNDNESS, height);
            curveTo(0, height, 0, height, 0, height - UIHelper.WINDOW_ROUNDNESS);
            lineTo(0, 0);
            closePath();
        }
    }
}

@@ -787,42 +787,8 @@
  %7D%0A%0A
-    // TODO fix topRounded method%0A
     
@@ -912,39 +912,14 @@
 (0, 
-0);%0A            lineTo(width, 0
+height
 );%0A 
@@ -940,23 +940,10 @@
 eTo(
-width, height -
+0,
  UIH
@@ -991,45 +991,19 @@
 eTo(
-width, height, width, height, width -
+0, 0, 0, 0,
  UIH
@@ -1018,38 +1018,33 @@
 NDOW_ROUNDNESS, 
-height
+0
 );%0A            l
@@ -1049,16 +1049,24 @@
  lineTo(
+width - 
 UIHelper
@@ -1084,22 +1084,17 @@
 NDNESS, 
-height
+0
 );%0A     
@@ -1112,41 +1112,34 @@
 eTo(
-0, height, 0, height, 0, height -
+width, 0, width, 0, width,
  UIH
@@ -1182,20 +1182,60 @@
  lineTo(
-0, 0
+width, height);%0A            lineTo(0, height
 );%0A     

Fix topRounded method to draw the correct shape