【发布时间】:2012-09-16 11:23:23
【问题描述】:
我正在尝试更改 BlackBerry BasicEditField 的宽度和高度。 但它没有像我提到的那样显示 BasicEditField。
HorizontalFieldManager HFMreg =
new HorizontalFieldManager(
HorizontalFieldManager.USE_ALL_WIDTH
| HorizontalFieldManager.USE_ALL_HEIGHT) {
//Override the paint method to draw the background image.
public void paint(Graphics graphics) {
//Draw the registration background image
graphics.drawBitmap(0,0,Display.getWidth(),Display.getHeight(),BMregbg, 0, 0);
super.paint(graphics);
}
};
BEFfirstname = new BasicEditField("","",5,EditField.NO_NEWLINE) {
protected void paint(Graphics graphics) {
graphics.fillRect(0,0,80,25);
graphics.setBackgroundColor(Color.WHITE);
graphics.clear();
super.paint(graphics);
}
protected void layout() {
super.layout(getPreferredWidth(),getPreferredHeight());
setExtent(80,25); //width,height
}
public int getPreferredWidth() {
int fieldWidth = 80; //required width
return fieldWidth;
}
public int getPreferredHeight() {
int fieldHeight = 25; // required height
return fieldHeight;
}
};
//BEFfirstname.setMargin(200,0,0,60);
HFMreg.add(LFfirstname);
HFMreg.add(BEFfirstname);
add(HFMreg);
【问题讨论】:
-
您说“它没有像我提到的那样显示 BasicEditField” - 如果您可以包含屏幕截图或描述输出的问题,将会很有帮助。 “不显示”很模糊
标签: blackberry height width