×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    280

    How to make a custom progress bar

    I am working on s40. i want to make custom progress bar which is loading in circular way . I got the following function in tutorial http://masterkissor.blogspot.in/2011...r-in-j2me.html

    How to implement this code.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,688

    Re: How to make a custom progress bar

    You need to invoke the code repeatedly as processing progresses or from a timer. The code seems to have an unmentioned variable, spinnerHour, which is expected to step between 0..11 to get the thing animated.

  3. #3
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Re: How to make a custom progress bar

    I think that what you need is here

    The LWUIT blog is more fiable than others

    http://lwuit.blogspot.com.es/2010/07...irst-post.html

  4. #4
    Registered User
    Join Date
    May 2013
    Posts
    280

    Re: How to make a custom progress bar

    sliders are not looking good so i am trying to put 10 images one after other which will look as one image is loading with effects. I am trying to create that animation. How to do it
    Last edited by Manpreet_Singh; 2013-07-18 at 07:05.

  5. #5
    Regular Contributor
    Join Date
    Dec 2012
    Location
    India
    Posts
    271

    Re: How to make a custom progress bar

    Kindly refer this article for animations with LWUIT

    https://today.java.net/pub/a/today/2...ith-lwuit.html

  6. #6
    Registered User
    Join Date
    May 2013
    Posts
    280

    Re: How to make a custom progress bar

    I referred but still confused with the code .

    Can you tell me which code in the given article resembles my requirement

  7. #7
    Regular Contributor
    Join Date
    Dec 2012
    Location
    India
    Posts
    271

    Re: How to make a custom progress bar

    Try this..

    Code:
           Image secondAnimation [] = new Image[10];
            try {
                for(int i=0;i<10;i++)
                {
                secondAnimation[i]  = Image.createImage("/"+i+".png");
                //secondAnimation[i]  = secondAnimation[i].scaled(50,50);
                }
            } catch (IOException ex) {
                //Logger.getLogger(myApp.class.getName()).log(Level.SEVERE, null, ex);
            }
    
                Label animation2 = new Label() {
                private int currentImage = 0;
                private long lastInvoke;
    
                public boolean animate() {
                    long current = System.currentTimeMillis();
                    if (current - lastInvoke > 75) {
                        lastInvoke = current;
                        currentImage++;
                        if (currentImage == secondAnimation.length) {
                            //busy.deregisterAnimated(this);
                            currentImage = 0;
                            return true;
    
                        }
                        return true;
                    }
                    return false;
                }
    
                public void paint(Graphics g) {
                    if (currentImage != 11) 
                      {
                        g.drawImage(secondAnimation[currentImage], getX(), getY());
                    }
                }
            };
    
            animation2.setPreferredSize(new Dimension(50, 50));
            animation2.getStyle().setBgTransparency(0);
            
            Form busy = new Form("Loading");
            busy.setLayout(new BorderLayout());
            busy.addComponent(BorderLayout.CENTER, animation2);
            busy.setShouldCalcPreferredSize(true);
            busy.registerAnimated(animation2);
            busy.show();
    Last edited by arunkam; 2013-07-18 at 10:16.

  8. #8
    Registered User
    Join Date
    May 2013
    Posts
    280

    Re: How to make a custom progress bar

    I implemented the following code. I am getting some errors. Where to put the name of 10 images and what is dcp?.

    I am getting error at this line secondAnimation = Image.createImage("/"+i+".png"); // error is cannot convert image to image[]
    animation2.setPreferredSize(new Dimension(50, 50)); // dimensions cannot be resolved to a type

  9. #9
    Regular Contributor
    Join Date
    Dec 2012
    Location
    India
    Posts
    271

    Re: How to make a custom progress bar

    Add this line to your imports

    import com.sun.lwuit.geom.Dimension;

    Name the images as 0.png,1.png etc.. and store them in the src directory.

    I have updated the code.Kindly use that.

  10. #10
    Registered User
    Join Date
    May 2013
    Posts
    280

    Re: How to make a custom progress bar

    thank you.. its working

  11. #11
    Registered User
    Join Date
    May 2013
    Posts
    280

    Re: How to make a custom progress bar

    I created animation using 10 images. Here is my png image i am using http://imgur.com/I8sk1G5. I have 10 images like this of same size. When i am applying animation on it from below code , my animation is coming as the pic is emerging from small to big outwards.

    But what i want is pic size should be same and the arrow is just pointing upwards direction.
    How to do this

  12. #12
    Regular Contributor
    Join Date
    Dec 2012
    Location
    India
    Posts
    271

    Re: How to make a custom progress bar

    I am sorry I am afraid I couldnt understand your problem correctly.

    If size is the problem, change the values of height and width in [I]secondAnimation.scaled(50,50);

    If possible, send us a video with a screen capture of what is being displayed right now.It may help us understand your situation more easily.

  13. #13
    Registered User
    Join Date
    May 2013
    Posts
    280

    Re: How to make a custom progress bar

    Hi arunkam, here is the link of the video http://videobam.com/qcZvr .
    This is the way i want animation to take place.
    Plz help

  14. #14
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,688

    Re: How to make a custom progress bar

    An animation is just an animation, it does not matter if it is a progress bar or a bouncing arrow, you just create the frames and draw them on top of each other with a timer as shown in Arunkam's code.

  15. #15
    Regular Contributor
    Join Date
    Dec 2012
    Location
    India
    Posts
    271

    Re: How to make a custom progress bar

    I agree with Wizard_hu.. The animation code is still valid.Each of those ten images should represent one frame from the animation.You shouldn't be having any problem then.

    There is one more way you could do this using just a single arrow image..You can try creating a custom animation in which the position of the arrow is changed by code (mainly the Y-Coordinate).I think it should work.Do give it a try.

Similar Threads

  1. How to make Uploading Progress
    By Kaz32 in forum Symbian Networking & Messaging (Closed)
    Replies: 10
    Last Post: 2011-09-30, 14:03
  2. How to make the custom light off?
    By shafali gupta in forum Symbian
    Replies: 1
    Last Post: 2008-10-01, 15:10
  3. Custom Progress Bar in J2ME
    By abbu in forum Mobile Java General
    Replies: 1
    Last Post: 2008-01-14, 22:05
  4. custom progress dialog
    By sriky27 in forum Symbian User Interface
    Replies: 4
    Last Post: 2007-02-20, 06:30
  5. Replies: 0
    Last Post: 2004-10-27, 15:44

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×