CustomLabelField LabelField? , (, , ..) LabelField, .
Field, setFont(Font). . .
CustomLabelField:
class CustomLabelField extends LabelField {
private int foregroundColor;
private int backgroundColor;
public CustomLabelField(String label, int foregroundColor,
int backgroundColor, long style) {
super(label, style);
this.foregroundColor = foregroundColor;
this.backgroundColor = backgroundColor;
}
protected void paint(Graphics graphics) {
graphics.setBackgroundColor(backgroundColor);
graphics.clear();
graphics.setColor(foregroundColor);
super.paint(graphics);
}
}
:
class MyScreen extends MainScreen {
public Font getMyFont(int fontSize) {
try {
FontFamily alphaSansFamily = FontFamily.forName("BBAlpha Serif");
return alphaSansFamily.getFont(Font.PLAIN, fontSize, Ui.UNITS_pt);
} catch (Exception e) {
}
return null;
}
public MyScreen() {
CustomLabelField clf = new CustomLabelField(
"Main",
Color.WHITE,
Color.BLACK,
LabelField.ELLIPSIS);
clf.setFont(getMyFont(20));
add(clf);
}
}