protected void alignText() {
        int xLoc, yLoc;
        int spacing = Math.max((int)Math.round(font.getSize() * spacingRatio), 1);
        int endIndex;

        switch (vAlign) {
            case (V_TOP) : yLoc = this.getLocationY(); break;
            case (V_CENTER) : yLoc = this.getLocationYC() - font.getSize()*lines.size()/2; break;
            case (V_BOTTOM) : yLoc = this.getLocationY() + this.getHeight() - font.getSize()*lines.size(); break;
            default : yLoc = this.getLocationY();
        }

        for (int l = 0; l < lines.size(); l++) {
            switch (hAlign) {
                case (H_LEFT) : xLoc = this.getLocationX(); break;
                case (H_CENTER) : xLoc = this.getLocationXC() - lines.get(l).width/2; break;
                case (H_RIGHT) : xLoc = this.getLocationX() + this.getWidth() - lines.get(l).width; break;
                default : xLoc = this.getLocationX();
            }

            endIndex = lines.get(l).startIndex + lines.get(l).numChars; //non-inclusive
            for (int c = lines.get(l).startIndex; c < endIndex; c++) {
                this.getSubComponent(c).setLocation(xLoc, yLoc);
                this.getSubComponent(c).setSize(font.getSize(), font.getSize());
                xLoc += font.getCharWidth(((CharComponent) this.getSubComponent(c)).getCharacter()) + spacing;
            }

            yLoc += font.getSize();
        }
    }