Skip to content

Instantly share code, notes, and snippets.

@andreybutov
Created August 11, 2018 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreybutov/f04100aa512991d16ab7b6d8ff338a45 to your computer and use it in GitHub Desktop.
Save andreybutov/f04100aa512991d16ab7b6d8ff338a45 to your computer and use it in GitHub Desktop.
A custom bordered edit field for BlackBerry apps.
//
// Andrey Butov ( andreybutov.com )
//
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment