我得到了这个......我想要下面的图像
我是黑莓的新手。
我想在我的应用程序中为圆形按钮字段提供粗边框。
下面是我的代码。
我创建了一个 CustomBasicEditField 类。
protected void paint(Graphics graphics)
{
int x = (this.getWidth() - getFont().getAdvance(text)) >> 1;
int y = (this.getHeight() - getFont().getHeight()) >> 1;
graphics.setColor(backgroundColour);
graphics.fillRoundRect(0, 0, fieldWidth, fieldHeight, 40, 40);
graphics.setColor(border_color);
graphics.setStrokeWidth(5);
graphics.drawRoundRect(0, 0, fieldWidth, fieldHeight, 40, 40);
graphics.setColor(0x2bb1ff);
graphics.setFont(myFont);
graphics.drawText(text, x, y);
super.paint(graphics);
}
如果我制作 drawRoundRect(0,0,fieldWidth, fieldHeight, 0, 0),那么它会打印一个带有粗边框的正方形。
但我不想要一个正方形。当我保留上面的代码时,它确实创建了一个圆形的编辑框,但边框很细。
提前致谢。