Bordered Edit Field for RIM BlackBerry UI
By Andrey Butov
December 15th, 2007
Someone asked for this via e-mail earlier this week. I thought I’d post it so other BlackBerry developers can use it.
Here’s a stripped-down version of a custom bordered edit field that we use in several of our BlackBerry products.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import net.rim.device.api.ui.component.EditField; import net.rim.device.api.ui.Graphics; class BorderedEditField extends EditField { BorderedEditField() { super(BorderedEditField.NO_NEWLINE); } BorderedEditField(long style) { super(style|BorderedEditField.NO_NEWLINE); } BorderedEditField(String label, String initialValue) { super(label, initialValue); } BorderedEditField(String label, String initialValue, int maxNumChars, long style) { super(label, initialValue, maxNumChars, style|BorderedEditField.NO_NEWLINE); } public void paint(Graphics g) { int oldColor = g.getColor(); g.setColor(0×00000000); g.drawRect(0, 0, getWidth() + 1, getHeight() + 1); g.setColor(oldColor); super.paint(g); } } |
Cheers!
