Skip to main content

Animation Issue

3 replies [Last post]
babuas
Offline
Joined: 2008-09-11

HI All,

I Posted my code in to this forum regarding for animation issue. When i'm using the latest jar and source code, animation is not working.

In Animation.res i took one animation.gif image, and through Resourceeditor.exe i added that image to the form.

when is use old jar, list scroll not working perfectly and Animation is working .

But i need to use source code. and i need to animation work properly.
If anyone having idea about this,Please help me.

public class OngoMusic extends MIDlet implements PlayerListener, MediaPlayerInterface {

private Player player;
private Form aniform;
private InputStream in;
private static OngoMusic mid = null;
MusicPlayer mp = null;

boolean isPlaying = true;

public void init() {

try {

Resources r = Resources.open("/res/AniTheme.res");
UIManager.getInstance().setThemeProps(r.getTheme("AniTheme"));
Player();
aniform = new Form();
aniform.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
Label L1 = new Label();
Label L2 = new Label();
Label L3 = new Label();
aniform.addComponent(L1);
aniform.addComponent(L2);
aniform.addComponent(L3);
Label label = new Label();
label.setText("MusicPlayer is Starting");
label.setAlignment(Label.CENTER);
Label label1 = new Label();
label1.setText("Please Wait....");
label1.setAlignment(Label.CENTER);
aniform.addComponent(label);
aniform.addComponent(label1);
aniform.show();
Thread.sleep(5000);
stopAudio();

} catch (InterruptedException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
}

protected void startApp() {
mid = this;
Display.init(this);
init(); // initmethod

new LoginForm(); // another form i called here
}

protected void pauseApp() {
}

protected void destroyApp(boolean un) {
notifyDestroyed();
}

public void exit() {
destroyApp(true);
}

Thanks&Regards,
Babu

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
babuas
Offline
Joined: 2008-09-11

hi Chen,

This is the url for my res image.

http://www.4shared.com/file/63195355/58b46e1a/AniTheme.html ---> this is animation theme.

http://www.4shared.com/file/63195989/e93bd9aa/ChefTheme.html-->this is theme used in loginform.

This is working for me also when I'm using the jar but the list scrolling is not working at this time.

Instead of jar if i used source code list scrolling is working but animation is not working.

How to make it work both the things(animation and list scrolling) in one application?

This is the [b]loginform[/b] constructor code.
try {
Resources r = Resources.open("/res/ChefTheme.res");
UIManager.getInstance().setThemeProps(r.getTheme("ChefTheme"));

} catch (IOException ioe) {
System.out.println("Couldn't load theme.");
}
loginForm = new Form("Ongo Music");

loginForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
loginForm.setScrollableY(false);

Label username = new Label("Username");
loginForm.addComponent(username);
username.getStyle().getBgTransparency();
loginForm.addComponent(getTxtNama());

Label passwordLbl = new Label("Password");
loginForm.addComponent(passwordLbl);
loginForm.addComponent(getTxtPass());

loginButton = new Button("LogIn");
loginButton.getStyle().setPadding(5, 5, 7, 7);

Container buttonPanel = new Container(new FlowLayout(Component.CENTER));
buttonPanel.addComponent(loginButton);
loginForm.addComponent(buttonPanel);

loginForm.show();

chen

Hi,
I'm guessing your GIF has 0 time for each frame which isn't supported
but is a common practice.
You should set the time for a sensible number at least 100ms.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> hi Chen,
>
> This is the url for my res image.
>
> http://www.4shared.com/file/63195355/58b46e1a/AniTheme.html ---> this is animation theme.
>
> http://www.4shared.com/file/63195989/e93bd9aa/ChefTheme.html-->this is theme used in loginform.
>
>
> This is working for me also when I'm using the jar but the list scrolling is not working at this time.
>
> Instead of jar if i used source code list scrolling is working but animation is not working.
>
> How to make it work both the things(animation and list scrolling) in one application?
>
> This is the [b]loginform[/b] constructor code.
> try {
> Resources r = Resources.open("/res/ChefTheme.res");
> UIManager.getInstance().setThemeProps(r.getTheme("ChefTheme"));
>
> } catch (IOException ioe) {
> System.out.println("Couldn't load theme.");
> }
> loginForm = new Form("Ongo Music");
>
> loginForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
> loginForm.setScrollableY(false);
>
> Label username = new Label("Username");
> loginForm.addComponent(username);
> username.getStyle().getBgTransparency();
> loginForm.addComponent(getTxtNama());
>
>
> Label passwordLbl = new Label("Password");
> loginForm.addComponent(passwordLbl);
> loginForm.addComponent(getTxtPass());
>
>
>
> loginButton = new Button("LogIn");
> loginButton.getStyle().setPadding(5, 5, 7, 7);
>
> Container buttonPanel = new Container(new FlowLayout(Component.CENTER));
> buttonPanel.addComponent(loginButton);
> loginForm.addComponent(buttonPanel);
>
> loginForm.show();
> [Message sent by forum member 'babuas' (babuas)]
>
> http://forums.java.net/jive/thread.jspa?messageID=299548
>
> ---------------------------------------------------------------------
> 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

chen

Hi Babu,
Your code works fine for me, send your res file and please describe more
what's not working for you.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> HI All,
>
> I Posted my code in to this forum regarding for animation issue. When i'm using the latest jar and source code, [b]animation[/b] is not working.
>
> In [b]Animation.res[/b] i took one [b]animation.gif[/b] image, and through Resourceeditor.exe i added that image to the form.
>
> when is use old jar, list scroll not working perfectly and Animation is working .
>
> But i need to use source code. and i need to animation work properly.
> If anyone having idea about this,Please help me.
>
> public class OngoMusic extends MIDlet implements PlayerListener, MediaPlayerInterface {
>
> private Player player;
> private Form aniform;
> private InputStream in;
> private static OngoMusic mid = null;
> MusicPlayer mp = null;
>
> boolean isPlaying = true;
>
> public void init() {
>
> try {
>
> Resources r = Resources.open("/res/AniTheme.res");
> UIManager.getInstance().setThemeProps(r.getTheme("AniTheme"));
> Player();
> aniform = new Form();
> aniform.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
> Label L1 = new Label();
> Label L2 = new Label();
> Label L3 = new Label();
> aniform.addComponent(L1);
> aniform.addComponent(L2);
> aniform.addComponent(L3);
> Label label = new Label();
> label.setText("MusicPlayer is Starting");
> label.setAlignment(Label.CENTER);
> Label label1 = new Label();
> label1.setText("Please Wait....");
> label1.setAlignment(Label.CENTER);
> aniform.addComponent(label);
> aniform.addComponent(label1);
> aniform.show();
> Thread.sleep(5000);
> stopAudio();
>
> } catch (InterruptedException ex) {
> ex.printStackTrace();
> } catch (IOException ex) {
> ex.printStackTrace();
> }
> }
>
> protected void startApp() {
> mid = this;
> Display.init(this);
> init(); // initmethod
>
> new LoginForm(); // another form i called here
> }
>
> protected void pauseApp() {
> }
>
> protected void destroyApp(boolean un) {
> notifyDestroyed();
> }
>
> public void exit() {
> destroyApp(true);
> }
>
>
>
> Thanks&Regards,
> Babu
> [Message sent by forum member 'babuas' (babuas)]
>
> http://forums.java.net/jive/thread.jspa?messageID=299526
>
> ---------------------------------------------------------------------
> 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