如何在blackberry的水平字段管理器中创建三个编辑文件
如何创建这样的三个编辑字段如何在blackberry的水平字段管理器中创建三个编辑文件,blackberry,Blackberry,如何创建这样的三个编辑字段 HorizontalFieldManager hfm_city=new HorizontalFieldManager(); VerticalFieldManager vfm_city = new VerticalFieldManager(); vfm_city.setBorder( BorderFactory.createBitmapBorder( new XYEdges(12,12,12,
HorizontalFieldManager hfm_city=new HorizontalFieldManager();
VerticalFieldManager vfm_city = new VerticalFieldManager();
vfm_city.setBorder(
BorderFactory.createBitmapBorder(
new XYEdges(12,12,12,12), borderBitmap
)
);
vfm_city.setMargin(0, 200, 0, 0);
final EditField city = new EditField("", "", 30, BasicEditField.FILTER_DEFAULT){
String emptyString = "City";
protected void paintBackground(Graphics g) {
g.setBackgroundColor(0xFFFFFF);
g.clear();
}
protected void paint(Graphics g) {
int oldColor = g.getColor();
try {
g.setColor(0x000000);
test = super.getText();
if ( test == null || test.length() < 1 ) {
//g.setColor(Config.hint_colour);
g.drawText(emptyString, 0, 0);
}
super.paint(g);
} finally {
g.setColor(oldColor);
}
}
};
vfm_city.add(city);
VerticalFieldManager vfm_state = new VerticalFieldManager();
vfm_state.setBorder(
BorderFactory.createBitmapBorder(
new XYEdges(12,12,12,12), borderBitmap
)
);
vfm_state.setMargin(0, 0, 0, 0);
final EditField state = new EditField("", "", 30, BasicEditField.FILTER_DEFAULT){
String emptyString = "State";
protected void paintBackground(Graphics g) {
g.setBackgroundColor(0xFFFFFF);
g.clear();
}
protected void paint(Graphics g) {
int oldColor = g.getColor();
try {
g.setColor(0x000000);
test = super.getText();
if ( test == null || test.length() < 1 ) {
//g.setColor(Config.hint_colour);
g.drawText(emptyString, 0, 0);
}
super.paint(g);
} finally {
g.setColor(oldColor);
}
}
};
vfm_state.add(state);
VerticalFieldManager vfm_zip = new VerticalFieldManager();
vfm_zip.setBorder(
BorderFactory.createBitmapBorder(
new XYEdges(12,12,12,12), borderBitmap
)
);
vfm_zip.setMargin(0, 0, 0, 0);
final EditField zip = new EditField("", "", 30, BasicEditField.FILTER_DEFAULT){
String emptyString = "Zip";
protected void paintBackground(Graphics g) {
g.setBackgroundColor(0xFFFFFF);
g.clear();
}
protected void paint(Graphics g) {
int oldColor = g.getColor();
try {
g.setColor(0x000000);
test = super.getText();
if ( test == null || test.length() < 1 ) {
//g.setColor(Config.hint_colour);
g.drawText(emptyString, 0, 0);
}
super.paint(g);
} finally {
g.setColor(oldColor);
}
}
};
vfm_zip.add(zip);
hfm_city.add(vfm_city);
hfm_city.add(vfm_state);
hfm_city.add(vfm_zip);
HorizontalFieldManager hfm_city=新HorizontalFieldManager();
VerticalFieldManager vfm_city=新建VerticalFieldManager();
vfm_city.sebtorder(
BorderFactory.createBitmapBorder(
新的XYEdges(12,12,12,12),边界位图
)
);
vfm_city.setMargin(0,200,0,0);
final EditField city=新的EditField(“,”,30,BasicEditField.FILTER\u默认值){
字符串emptyString=“城市”;
受保护的空白油漆背景(图形g){
g、 立根基色(0xFFFFFF);
g、 清除();
}
受保护的空心漆(图g){
int oldColor=g.getColor();
试一试{
g、 setColor(0x000000);
test=super.getText();
if(test==null | | test.length()<1){
//g、 设置颜色(配置提示颜色);
g、 drawText(清空字符串,0,0);
}
超级油漆(g);
}最后{
g、 setColor(oldColor);
}
}
};
vfm_city.add(城市);
VerticalFieldManager vfm_state=新建VerticalFieldManager();
vfm_state.setboorder(
BorderFactory.createBitmapBorder(
新的XYEdges(12,12,12,12),边界位图
)
);
vfm_state.setMargin(0,0,0,0);
最终EditField状态=新EditField(“,”,30,BasicEditField.FILTER\u默认值){
字符串emptyString=“State”;
受保护的空白油漆背景(图形g){
g、 立根基色(0xFFFFFF);
g、 清除();
}
受保护的空心漆(图g){
int oldColor=g.getColor();
试一试{
g、 setColor(0x000000);
test=super.getText();
if(test==null | | test.length()<1){
//g、 设置颜色(配置提示颜色);
g、 drawText(清空字符串,0,0);
}
超级油漆(g);
}最后{
g、 setColor(oldColor);
}
}
};
vfm_state.add(state);
VerticalFieldManager vfm_zip=新建VerticalFieldManager();
vfm_邮政编码订单(
BorderFactory.createBitmapBorder(
新的XYEdges(12,12,12,12),边界位图
)
);
vfm_zip.setMargin(0,0,0,0);
final EditField zip=new EditField(“,”,30,BasicEditField.FILTER\u默认值){
字符串emptyString=“Zip”;
受保护的空白油漆背景(图形g){
g、 立根基色(0xFFFFFF);
g、 清除();
}
受保护的空心漆(图g){
int oldColor=g.getColor();
试一试{
g、 setColor(0x000000);
test=super.getText();
if(test==null | | test.length()<1){
//g、 设置颜色(配置提示颜色);
g、 drawText(清空字符串,0,0);
}
超级油漆(g);
}最后{
g、 设置颜色(ol)
VerticalFieldManager vfm_city = new VerticalFieldManager() {
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(Display.getwidth()/3,30);
setExtent(Display.getwidth()/3,30);
}
};
{
Border bdr = BorderFactory.createRoundedBorder(new XYEdges(4, 4, 4, 4),Border.STYLE_SOLID);
VerticalFieldManager vert=new VerticalFieldManager()
{
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(Display.getWidth(),Display.getHeight());
setExtent(Display.getWidth(),Display.getHeight());
}
};
HorizontalFieldManager hr=new HorizontalFieldManager(USE_ALL_HEIGHT)
{
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(Display.getWidth(),50);
setExtent(Display.getWidth(),50);
}
};
hr.setBackground(BackgroundFactory.createSolidBackground(Color.GREEN));
EditField e1=new EditField(Field.FOCUSABLE|Field.FIELD_VCENTER){
protected void layout(int width, int height) {
super.layout(100,30);
setExtent(100,30);
}
};
EditField e2=new EditField(Field.FOCUSABLE|Field.FIELD_VCENTER){
protected void layout(int width, int height) {
super.layout(60,30);
setExtent(60,30);
}
};
EditField e3=new EditField(Field.FOCUSABLE|Field.FIELD_VCENTER){
protected void layout(int width, int height) {
super.layout(60,30);
setExtent(60,30);
}
};
e1.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));
e2.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));
e3.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));
e1.setPadding(0, 0, 0, 10);
e2.setPadding(0, 0, 0, 20);
e3.setPadding(0, 0, 0, 10);
e1.setBorder(bdr);
e2.setBorder(bdr);
e3.setBorder(bdr);
hr.add(e1);
hr.add(e2);
hr.add(e3);
vert.add(hr);
add(vert);
}