我使用Bikas发布的示例代码实现了一个自定义按钮: http://supportforums.blackberry.com/t5/Java-Development/fixedwidth-buttonField-cannot-center-text/m-p/239116
但是,我希望按钮看起来像默认的Blackberry按钮。
如何将下面显示的paint方法修改为默认按钮?
protected void paint(Graphics graphics)
{
int w = width - (leftMargin + rightMargin);
int h = height - (topMargin + bottomMargin);
if(isFocus() == false)
{
graphics.setColor(backgroundColorNormal);
graphics.fillRoundRect(leftMargin, topMargin, w, h, 6, 6);
graphics.setColor(0x00394142);
graphics.drawRoundRect(leftMargin, topMargin, w, h, 6, 6);
graphics.drawText(label, labelTopLeftPoint.x, labelTopLeftPoint.y);
}
else
{
graphics.setColor(backgroundColorOnFocus);
graphics.fillRoundRect(leftMargin, topMargin, w, h, 6, 6);
graphics.drawRoundRect(leftMargin, topMargin, w, h, 6, 6);
graphics.setColor(0x00ffffff);
graphics.drawText(label, labelTopLeftPoint.x, labelTopLeftPoint.y);
}
}
在搜索时,我似乎无法在任何地方找到此信息。
感谢您的帮助,
有状态
答案 0 :(得分:1)
在Eclipse或旧版JDE中,将未修改的ButtonField添加到应用程序中,在初始化对象后放置断点并检查未修改的ButtonField的详细信息以获取所需的属性。