Blackberry UI tool bar : fields alignment

Posted by Galaxy on Stack Overflow See other posts from Stack Overflow or by Galaxy
Published on 2010-05-22T08:52:04Z Indexed on 2010/05/22 9:00 UTC
Read the original article Hit count: 164

Filed under:
|

i am developing custom toolbar manager, but i want to adjust the fields alignment to be centered not aligned to the left , any advice

below is the code of toolbar

    package galaxy.bb.ui.container;

import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.XYEdges;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.decor.Background;
import net.rim.device.api.ui.decor.BackgroundFactory;
import net.rim.device.api.ui.decor.Border;
import net.rim.device.api.ui.decor.BorderFactory;

public class ToolBarManager extends HorizontalFieldManager {
private int bgColor = Color.BLACK;
private int borderColor = Color.WHITE;
private int borderStyle= Border.STYLE_FILLED;

public ToolBarManager(){
    super(USE_ALL_WIDTH);
    }
public ToolBarManager(int bgColor) {
    super(USE_ALL_WIDTH);
    this.bgColor = bgColor;
}
public ToolBarManager(int bgColor, int borderStyle) {
    super(USE_ALL_WIDTH);
    this.bgColor = bgColor;
    this.borderStyle = borderStyle;
}


public int getBgColor() {
    return bgColor;
}

public void setBgColor(int bgColor) {
    this.bgColor = bgColor;
}


public int getBorderColor() {
    return borderColor;
}

public void setBorderColor(int borderColor) {
    this.borderColor = borderColor;
}

public int getBorderStyle() {
    return borderStyle;
}

public void setBorderStyle(int borderStyle) {
    this.borderStyle = borderStyle;
}

protected void paint(Graphics graphics) {
    super.paint(graphics);
    XYEdges padding = new XYEdges(5, 5, 5, 5);

    Border roundedBorder = BorderFactory.createRoundedBorder(padding,
            borderColor, borderStyle);
    this.setBorder(roundedBorder);
    Background bg = BackgroundFactory.createSolidBackground(bgColor);
    this.setBackground(bg);

}

}

© Stack Overflow or respective owner

Related posts about blackberry

Related posts about gui