EditFields 周围的边框 - Blackberry
我正在尝试在两个文本框周围绘制边框,如果我单独保留主屏幕的背景颜色,则该边框有效。客户的规格要求采用蓝色背景的配色方案。当 EditFields 被绘制到屏幕上时,它们将显示为跨越屏幕的一个字段。有 2 个,因为每个都在应该有两个时获得焦点,否则一切正常。然后将两个 EditField 添加到 GridFieldManager 以控制布局。
我正在对 EditField 进行子类化并添加每个 EXEditField 周围的边框,如下所示:
public class EXEditField extends EditField {
...
private void init( MainScreen scrn ) {
if ( this.hasVirtualKeyboard() )
this.vkbd = scrn.getVirtualKeyboard();
this.setMaxSize( this.MAX_CHARS );
this.setBorder( BorderFactory.createRoundedBorder(new XYEdges(0,0,0,0), Border.STYLE_SOLID) );
this.setBackground( BackgroundFactory.createSolidBackground(Color.WHITE) );
//this.setPadding( 3, 3, 3, 3 );
//this.setMargin( 0, 3, 0, 3 );
}
...
} // end class
非常感谢任何帮助,因为没有太多好的 Blackberry 参考文档。
I am trying to draw a border around two text boxes, which works if I leave background colour of the main screen alone. The client's spec's call for a colour scheme with a blue background. When the EditFields are drawn to the screen, they appear as one field that spans the screen. There are 2 since each gets focus when it's supposed two and everything works otherwise. The two EditFields are then added to a GridFieldManager to control the layout.
I am subclassing the EditFields and adding the border around each of the EXEditFields, like so:
public class EXEditField extends EditField {
...
private void init( MainScreen scrn ) {
if ( this.hasVirtualKeyboard() )
this.vkbd = scrn.getVirtualKeyboard();
this.setMaxSize( this.MAX_CHARS );
this.setBorder( BorderFactory.createRoundedBorder(new XYEdges(0,0,0,0), Border.STYLE_SOLID) );
this.setBackground( BackgroundFactory.createSolidBackground(Color.WHITE) );
//this.setPadding( 3, 3, 3, 3 );
//this.setMargin( 0, 3, 0, 3 );
}
...
} // end class
Any help is greatly appreciated since there is not much in the way good Blackberry reference docs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,检查这个。
它是一个开源库,提供一些自定义 BlackBerry 字段,包括带有自定义边框的 EditField。您应该能够修改代码以显示您想要的边框。
Ok, check this.
It is an open source library that provides some custom BlackBerry fields, including an EditField, with custom borders. You should be able to modify the code to display the borders you want.
您可以尝试更改自定义 EditField 中的 PaintBackground 方法,尝试将此代码放入您的 EditField 类中:
You might try changing the paintBackground method within your custom EditField, try putting this code into your EditField class: