public void paintComponent(Graphics gfx) {
        super.paintComponent(gfx);
        Graphics2D g = (Graphics2D) gfx;
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
        RenderingHints.VALUE_ANTIALIAS_ON);
        g.setPaint(Color.blue);     
      //Draw all the lines
                for(int i = 0; i < (items.length - 1); i++){
            g.draw(lines[i]);
        }
        
        Shape[] s;
        s = new Shape[items.length];
        String temp;
        g.setColor(Color.DARK_GRAY);
        
        for(int i = 0; i < items.length; i++){
            Float test = new Float((205 - p[i].y) / 200);
            temp = test.toString();
            g.drawString(temp.substring(0,3), (p[i].x + 5),p[i].y);
            s[i] = p[i].getShape();
        }
        
        g.setColor(Color.red);      
        //g.fill(s0);  g.fill(s1);
        for(int i = 0; i < items.length; i++){
            g.fill(s[i]);
        }
        g.setColor(Color.black);    
       // g.draw(s0);  g.draw(s1);
        for(int i = 0; i < items.length; i++){
            g.draw(s[i]);
        }
        //Draw the Line axis
        g.drawLine(50, 5, 50, 205); //y-axis
        g.drawLine(50, 205, 260, 205); //x-axis
        //Draw the static labels
        String utility_label = new String("Utility");
        g.setFont(new Font(null, Font.BOLD, 12));
        g.drawString(utility_label, 10, 110);
        String utility_upper_bound = new String("1");
        g.drawString(utility_upper_bound, 35, 15);
        String utility_lower_bound = new String("0");
        g.drawString(utility_lower_bound, 35, 205);
        
        //Drawing the labels from variables passed
         g.setFont(new Font(null, Font.BOLD, 12));
         int len = (attributeName + " (" + unit + ")").length();
         g.setFont(new Font(null, Font.BOLD, 13));
        g.drawString((attributeName + " (" + unit + ")"), 150 - 3 * len ,240);
        //Labelling different utilities
        for(int i = 0; i < items.length; i++){
           if((weights[i] == 0.0) || (weights[i] == 1.0)){
                g.setFont(new Font(null, Font.BOLD, 12));
            }
            else{
                g.setFont(new Font(null, Font.PLAIN, 12));
            }           
           DecimalFormat df = acell.obj.decimalFormat;;            
           g.drawString((df.format(items[i])),((int)(((items[i]-items[0])/((items[(items.length)-1])-items[0]))*200))+40 ,220);
        }	
        
        //Drawing the Undo and Redo button
        g.setColor(Color.RED);
        g.setFont(new Font(null, Font.PLAIN, 12));
        g.drawString("UNDO", 2, 255);
        g.drawString("REDO", 235, 255);
        
    }