@Override
    public void repaint(TextGraphics graphics)
    {
        if(hasFocus())
            graphics.applyTheme(graphics.getTheme().getDefinition(Theme.Category.BUTTON_ACTIVE));
        else
            graphics.applyTheme(graphics.getTheme().getDefinition(Theme.Category.BUTTON_INACTIVE));
        
        TerminalSize preferredSize = calculatePreferredSize();
        graphics = transformAccordingToAlignment(graphics, preferredSize);

        if(graphics.getWidth() < preferredSize.getColumns()) {
            graphics.drawString(0, 0, "< ");
            graphics.drawString(graphics.getWidth() - 2, 0, " >");
            
            int allowedSize = graphics.getWidth() - 4;
            if(allowedSize > 0) {
                TextGraphics subGraphics = graphics.subAreaGraphics(new TerminalPosition(2, 0),
                        new TerminalSize(allowedSize, buttonLabel.getPreferredSize().getRows()));
                buttonLabel.repaint(subGraphics);
            }
        }
        else {
            int leftPosition = (graphics.getWidth() - preferredSize.getColumns()) / 2;
            graphics.drawString(leftPosition, 0, "< ");
            final TerminalSize labelPrefSize = buttonLabel.getPreferredSize();
            TextGraphics subGraphics = graphics.subAreaGraphics(
                    new TerminalPosition(leftPosition + 2, 0),
                    new TerminalSize(labelPrefSize.getColumns(), labelPrefSize.getRows()));
            buttonLabel.repaint(subGraphics);
            graphics.drawString(leftPosition + 2 + labelPrefSize.getColumns(), 0, " >");
        }    
        setHotspot(null);
    }