@Override
    public void repaint(TextGraphics graphics)
    {
    	int bar_start = isCompletedPercentageShown() ? 5 : 0;
        int total_width = graphics.getWidth() - bar_start;
        int highlighted_blocks = (int) (total_width * progress);
        
        if (isCompletedPercentageShown()) {
        	graphics.applyTheme(Category.BUTTON_LABEL_INACTIVE);
        	Integer percentage = (int) Math.round(progress * 100);
        	String perc_str;
        	if (percentage == 100)
        		perc_str = percentage + "%";
        	else if (percentage >= 10)
        		perc_str = " " + percentage + "%";
        	else
        		perc_str = "  " + percentage + "%";
        	
        	graphics.drawString(0, 0, perc_str);
        }
        
        graphics.applyTheme(Category.PROGRESS_BAR_COMPLETED);
        graphics.fillRectangle(fill_complete_char, new TerminalPosition(bar_start, 0), new TerminalSize(bar_start + highlighted_blocks, 1));
        graphics.applyTheme(Category.PROGRESS_BAR_REMAINING);
        graphics.fillRectangle(fill_remaining_char, new TerminalPosition(bar_start + highlighted_blocks, 0), new TerminalSize(total_width - highlighted_blocks, 1));
    }