1

可能な限りLWUITResourceEditorを使用してアプリケーションを作成しようとしています。つまり、可能であればコードによるUIの作成は避けています。

RadioButtonリソースエディタツールで対応するプロパティを設定することにより、グループをに割り当てる可能性があることがわかりました。

したがって、これらのラジオボタンにいくつかの機能を実装する必要があるので、作成したButtonGroupインスタンスへの参照をどのように取得できますUIBuilderか(私は推測します)。

はい、リソースエディターツールを使用してミッドレットを生成していることを考えると、「カスタム」コードはStateMachineクラスに記述されています。

よろしく。

4

1 に答える 1

2

AFAIK you can't get ButtonGroup from ResourceEdit#GUI. You can only possible to get RadioButton group name. But possible to add the RadioButton into ButtonGroup through your code. See the following code,

For calling StateMachine() constructor(use this code inside of constructor),

Form form = (Form) this.startApp(resources, null, true);
 RadioButton rb1 = this.findRadioButton(form);
 RadioButton rb = this.findRadioButton1(form);
 ButtonGroup bg = new ButtonGroup();
 bg.add(rb);
 bg.add(rb1);
 bg.setSelected(0);

For calling StateMachine(String resFile) constructor(use this code inside of your MIDlet class),

 StateMachine sm = new StateMachine("/Sample.res");
 RadioButton rb1 = sm.findRadioButton(Display.getInstance().getCurrent());
 RadioButton rb = sm.findRadioButton1(Display.getInstance().getCurrent());
 ButtonGroup bg = new ButtonGroup();
 bg.add(rb);
 bg.add(rb1);
 bg.setSelected(0);
于 2011-07-26T13:36:32.323 に答える