1

I want to display among other things a Label containing an Image , the image in this Label is a Timeline :

enter image description here

In fact I got the image from the web : it is an animated gif , so when I added it into the Resource Editor then it was automatically converted into Timeline. Then I added the Label into my Form :

public class Login extends Ecran implements ActionListener {
...
public Login(SmartPhoneBanking c, Form prevForm) {
   ...
   patientez = new Label((MenuPrincipalForm.r).getImage("roller_fond_blanc")); // r is the LWUIT Resources , you can see the roller_fond_blanc Timeline in the attached image
   patientez.setAlignment(Label.CENTER);
   ...
   cPatienter.addComponent(patientez);
   ...
   }
   ...
   public void actionPerformed(ActionEvent evt) 
   {
        ...
        if (evt.getSource() == validerBtn)
        {
            getTitleComponent().setVisible(false);
            cntnr.removeComponent(cBtn);
            cntnr.removeComponent(libAndFieldContainer);
            removeCommand(listeMenu);
            cntnr.addComponent(cPatienter); // showing the "Please wait" labels and the Timeline
            repaint();
            Display.getInstance().callSerially(new Runnable()
                                               {
                                                   public void run() {
                                                       download();
                                                   }
                                                });
        }
}

I included the repaint() method because without it the "please wait" labels are not shown.

So why isn't the Timeline animated ?

4

3 に答える 3

3

EDTについて読む必要があります。呼び出しでアクションを連続して実行している場合、LWUITがイベントの描画と処理に使用するイベントディスパッチスレッドをブロックしています。これは、LWUITで競合状態を起こすことができないため、小さなことには適しています。

ただし、長いプロセスを実行する場合、このブロッキングは問題になります。呼び出しとブロックは、シリアル呼び出しの正反対であり、「安全な方法」でEDTをブロックし、非常に長い可能性のある別のスレッドで操作を実行します。(long io)invokeAndBlockをダウンロードする場合、または実際には別のスレッドにまたがる場合は、正しいことです。LWUIT4IOはそれをシームレスに行います。

于 2011-12-18T05:09:27.673 に答える
2

I did the same process as you. But I included the image straight in the Form using the resource editor and it works.

Try to do that.

Download the lastest version of LWUIT.(1.5) Create the image as a Timeline In the GUI Builder tab of the resource editor put the image in a Form

于 2011-12-16T08:43:17.970 に答える
0

に置き換えcallSeriallyinvokeAndBlock、タイムラインをアニメーション化しました。

于 2011-12-16T13:36:04.923 に答える