View Javadoc

1   package net.sourceforge.barbecue.output;
2   
3   public class CenteredLabelLayout extends LabelLayout {
4   	/** Pixel gap between the barcode bars and the top of the data text underneath */
5       public static final int BARS_TEXT_VGAP = 5;
6   
7   	public CenteredLabelLayout(int x, int y, int width) {
8   		super(x, y, width, BARS_TEXT_VGAP);
9   	}
10  
11  	protected void calculate() {
12  		textX = (float) ((((width - x) - textLayout.getBounds().getWidth()) / 2) + x);
13  		textY = (float) (y + textLayout.getBounds().getHeight() + BARS_TEXT_VGAP);
14  		int height = (int) (textLayout.getBounds().getHeight() + BARS_TEXT_VGAP + 1);
15  		bgX = x;
16  		bgY = y;
17  		bgWidth = width - x;
18  		bgHeight = height;
19  	}
20  }