ボタンフィールドの下にCustomLabelFieldを配置することができます。 ButtonFields onFocus(int direction)
およびonUnfocus()
メソッドをオーバーライドします。それらの中にあなたがこのカスタムボタンを使用して、それにあなたの追加機能を追加することができます(コメントの後に)あなたのCustomLabelField
class CustomLabelField extends Field {
String label;
public void setLabel(String label){
this.label = label;
invalidate();
}
protected void layout(int arg0, int arg1) {
setExtent(Display.getWidth, getFont().getHeight());
}
protected void paint(Graphics graphics) {
graphics.setColor(Color.Black);
graphics.drawText(label, 0, 0);
}
}
EDIT
のsetLabel(String label)
メソッドを呼び出します。これがうまくいけば試してみませんでしたが、うまくいくはずです。
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.container.MainScreen;
public class CustomButtonField extends BitmapField{
private String label = "";
private MainScreen yourScreen;
public CustomButtonField(String label, MainScreen yourScreen) {
super();
this.label = label;
this.yourScreen = yourScreen;
}
protected void onFocus(int direction) {
yourScreen.setTitle(label);
super.onFocus(direction);
}
protected void onUnfocus() {
yourScreen.setTitle("");
super.onUnfocus();
}
}
私は過書き込みアプリケーションのタイトルバーをにラベルをご希望の場合、それは可能ですか?しかし、それは良い助けです、ありがとうございます〜 – ocinisme
はい、可能です。 –
どうやって説明すればいいですか? – ocinisme