Skip to main content

ANIMATION ISSUE

5 replies [Last post]
elie
Offline
Joined: 2008-06-11

HELLO ALL,

I am trying to get an animation from a resource file.

some are working well and some throws a java.lang.ArithmeticException exception.

Can i know the aim of this exception so that we avoid using such GIF file.

thank you

java.lang.ArithmeticException
at com.sun.lwuit.StaticAnimation.animate(StaticAnimation.java:184)
at com.sun.lwuit.Label.animate(Label.java:282)
at com.sun.lwuit.Form.repaintAnimations(Form.java:665)
at com.sun.lwuit.Implementation.edtLoopImpl(Implementation.java:590)
at com.sun.lwuit.Implementation.mainEDTLoop(Implementation.java:547)
at com.sun.lwuit.Implementation.run(Implementation.java:508)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Shai Almog

Hi Elie,
I looked at the image and it seems it has 0 ms set for every frame (I
assume you wanted the animation to be as fast as possible). This will
indeed cause that application, I didn't account for that ;-)
I will fix this issue for the next version, in the meantime just set
the animation to 1ms or more per frame.

Thanks,
Shai.

> Dear Shai,
>
> reagarding the first question i am using the LWUIT_20080605 version.
> regarding question 2 :
>
> i add to the .res file the animation usig the resource editor and
> the animation is shown normaly there.
>
> the code that i use is :
>
> try {
> r = Resources.open("/weathertheme.res");
> Button btn = new Button(r.getAnimation
> ("rain"));
> btn.setBorderPainted(false);
> btn.getStyle().setBgTransparency(0);
> Container pair = new Container(new
> FlowLayout(Component.CENTER));
> pair.addComponent(btn);
> weatherform.addComponent(pair);
>
> }
> catch (Exception ioe) {
>
> }
> weatherform.show();
>
> when the form is displayed on the emulator directly the dialog is
> shown right after.
>
>
> Please CAn you inform me how can i attach file to the thread so
> that i attach u the GIF file
> [Message sent by forum member 'elie' (elie)]
>
> http://forums.java.net/jive/thread.jspa?messageID=284961
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

elie
Offline
Joined: 2008-06-11

THANK YOU

Shai Almog

Hi Elie,
this should never occur. First, please confirm you are using the
latest version of LWUIT (latest drop is from the 25th of June)...

Next please explain how you create the animation?
Do you add it in the resource editor or do you use the Ant task?

If the latter can you open the res file using the resource editor? Is
it working there?
(if an animation is working in the resource editor it should work on
the device)

Technically all gif's should work without exceptions, transparent
gifs aren't supported since this complicates many issues so it is
currently assumed all animations are opaque.

If you can send me the gif file that is failing for you I can try to
reproduce and investigate the issue.

Thanks,
Shai.

On Jul 8, 2008, at 10:39 AM, lwuit-users@mobileandembedded.org wrote:

> HELLO ALL,
>
> I am trying to get an animation from a resource file.
>
> some are working well and some throws a
> java.lang.ArithmeticException exception.
>
> Can i know the aim of this exception so that we avoid using such
> GIF file.
>
> thank you
>
> java.lang.ArithmeticException
> at com.sun.lwuit.StaticAnimation.animate
> (StaticAnimation.java:184)
> at com.sun.lwuit.Label.animate(Label.java:282)
> at com.sun.lwuit.Form.repaintAnimations(Form.java:665)
> at com.sun.lwuit.Implementation.edtLoopImpl
> (Implementation.java:590)
> at com.sun.lwuit.Implementation.mainEDTLoop
> (Implementation.java:547)
> at com.sun.lwuit.Implementation.run(Implementation.java:508)
> [Message sent by forum member 'elie' (elie)]
>
> http://forums.java.net/jive/thread.jspa?messageID=284949
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

elie
Offline
Joined: 2008-06-11

Dear Shai,

reagarding the first question i am using the LWUIT_20080605 version.
regarding question 2 :

i add to the .res file the animation usig the resource editor and the animation is shown normaly there.

the code that i use is :

try {
r = Resources.open("/weathertheme.res");
Button btn = new Button(r.getAnimation("rain"));
btn.setBorderPainted(false);
btn.getStyle().setBgTransparency(0);
Container pair = new Container(new FlowLayout(Component.CENTER));
pair.addComponent(btn);
weatherform.addComponent(pair);

}
catch (Exception ioe) {

}
weatherform.show();

when the form is displayed on the emulator directly the dialog is shown right after.

Please CAn you inform me how can i attach file to the thread so that i attach u the GIF file

Shai Almog

Hi Elie,
Attachments apparently can only be sent through the email gateway and
not by forum users. You can try just send the file directly to my Sun
address which is Shai.Almog (AT) sun.com
The code seems reasonable but I have a few followup questions:

1. Did you try this with the latest LWUIT?

2. Is this issue occurring with every gif file or only with this
specific GIF file?

3. The code bellow might be occuring in a separate thread causing a
race condition (which will not exist in the next drop). Can you check
that by adding:
System.out.println("" + Display.getInstance().isEDT());
Right above the call to show();

If the printout is false try:
Display.getInstance().callSerially(new Runnable() {
public void run() {
// you will need to declare weatherForm as final or as a class member
weatherForm.show();
}
});

Thanks,
Shai.

> Dear Shai,
>
> reagarding the first question i am using the LWUIT_20080605 version.
> regarding question 2 :
>
> i add to the .res file the animation usig the resource editor and
> the animation is shown normaly there.
>
> the code that i use is :
>
> try {
> r = Resources.open("/weathertheme.res");
> Button btn = new Button(r.getAnimation
> ("rain"));
> btn.setBorderPainted(false);
> btn.getStyle().setBgTransparency(0);
> Container pair = new Container(new
> FlowLayout(Component.CENTER));
> pair.addComponent(btn);
> weatherform.addComponent(pair);
>
> }
> catch (Exception ioe) {
>
> }
> weatherform.show();
>
> when the form is displayed on the emulator directly the dialog is
> shown right after.
>
>
> Please CAn you inform me how can i attach file to the thread so
> that i attach u the GIF file
> [Message sent by forum member 'elie' (elie)]
>
> http://forums.java.net/jive/thread.jspa?messageID=284961
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net