Waiting on a Swing Timer To Finish

This is my first post so if I've done something wrong I am very sorry. I am Trying to move a sprite across the screen when the user pushes a JButton. To accomplish this I am using a swing timer the problem is I need to execute some method after the animation is finished, but since both the animation and the other code run on the EDT the code I place after the animation executes first. I've tried using threads, but that did not help. I have included an example below, thanks in advance.
// called by the JButton's ActionListener
public void actionPerformed(ActionEvent e)
     methodToBeCalledBeforeAnimation();
     animateSprite(x_start, y_start, x_end, y_end, mySprite);
     methodToBeCalledAfterAnimation();
public void animateSprite(x_start, y_start, x_end, y_end, Sprite sprite)
     int delay= 10;
     if (getTimer()!= null) return;
          class Animator implements ActionListener
               int maxFrames= 50;
               int frames= 0;
               int x_start;
               int y_start;
               int x_end;
               int y_end;
               int width;
               int height;
                  Sprite sprite
               double x_curr;
               double y_curr;
               public Animator(int x_start, int y_start, int x_end, int y_end, int width,
                                  int height, Sprite sprite)
                    this.x_start= x_start;
                    this.y_start= y_start;
                    this.x_end= x_end;
                    this.y_end= y_end;
                    this.width= width;
                    this.height= height;
                    this.sprite= sprite;
                    sprite.setHeight(height);
                    sprite.setWidth(width);
                    x_curr= x_start;
                    y_curr= y_start;
               public void actionPerformed(ActionEvent evt)
                    x_curr= (double)sprite.getX()+(double)x_end/(double)maxFrames;
                    y_curr= (double)sprite.getY()+(double)y_end/(double)maxFrames;
                    sprite.setX((int)x_curr);
                    sprite.setY((int)y_curr);
                                // sprite is drawn in paintComponent
                    repaint();
                    frames++;
                    if (frames==maxFrames)
                         getTimer().stop();
                         setTimer(null);
                         repaint();
          setTimer(new Timer(delay, new Animator(x_start, y_start, x_end, y_end, width,
                                            height, card)));
          getTimer().start();
          return;
}Edited by: Pherpq on Jul 18, 2008 5:53 PM

Hi,
try to change the method from
// FROM:
     public void actionPerformed(ActionEvent e)
          methodToBeCalledBeforeAnimation();
                    animateSprite(x_start, y_start, x_end, y_end, mySprite);
                    methodToBeCalledAfterAnimation();
// TO:
  //      called by the JButton's ActionListener
     public void actionPerformed(ActionEvent e)
          methodToBeCalledBeforeAnimation();
          animateSprite(x_start, y_start, x_end, y_end, mySprite);
                       TimerQueue is a thread so wait for this thread to die before you
                      continue
          if(getTimer()!= null) {
               getTimer().timerQueue().join();
          methodToBeCalledAfterAnimation();
     }I will not comment on the design approach for the method animateSprite(x_start, y_start, x_end, y_end, mySprite); since this is out of scope for this post.
I hope this could help.
Regards,
Alan Mehio
London, UK
Edited by: alan_mehio on 21-Jul-2008 11:34

Similar Messages

  • How can I wait until a Swing.Timer has finished?

    I have a Swing.Timer runing which displays some animated text (more precisely it fades out a text with a delay of 50 until all characters are erased.
    Afterwards a time consuming operation shall begin. How can I achieve that this operation waits to start until the text has been faded out? The time to fade out the text depends on the length of the text, of course.
    So, how can I make the operation waiting until the Timer has finished its work?
    Thanks,
    Dirk

    dirku wrote:
    I have a Swing.Timer runing which displays some animated text (more precisely it fades out a text with a delay of 50 until all characters are erased.
    Afterwards a time consuming operation shall begin. How can I achieve that this operation waits to start until the text has been faded out? The time to fade out the text depends on the length of the text, of course.
    So, how can I make the operation waiting until the Timer has finished its work?I gave you an answer to this with sample code yesterday:
    [http://forum.java.sun.com/thread.jspa?threadID=5294087&messageID=10244564#10244564|http://forum.java.sun.com/thread.jspa?threadID=5294087&messageID=10244564#10244564]
            public void actionPerformed(ActionEvent e)
                if (sb.length() > 0)
                    sb.deleteCharAt(0);
                    label.setText(sb.toString());
                else
                    label.setForeground(color);
                    label.setText(text);
                    Timer timer = (Timer)e.getSource();
                    timer.stop();
                    // ***** start process here ***
            }The timer here continues until a condition is satisfied (here it's where the Stringbuffer that holds the text that is sent to the JLabel is empty). So all you have to do is place any code that needs to happen when the Timer ends in the else block. It's so simple as to be trivial.

  • Can't dispose my dialog after moving it using swing timer.

    Hi all,
    I use the swing timer to move a dialog from one position to another. Here is the code I have use.
    // Set the main window display location
        public void setWindowLocation()
            int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
            int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
            int frameHeight = this.getHeight();
            int frameWidth = this.getWidth();
            int _xValue = (screenWidth - frameWidth);
            int _yValue = (screenHeight - getTrayheight() );
            int _yEnd = (screenHeight - frameHeight - getTrayheight() );
            //this.setLocation((screenWidth - frameWidth), (screenHeight - frameHeight - getTrayheight() - WINDOW_SPACE));
            this.setLocation(_xValue, _yValue);
            while(_yValue > _yEnd){
                dialogMotion(this, _xValue, _yValue);
                _yValue -= 1;
            // this.dispose();
    // Dialog motion
        private void dialogMotion(final MainDialog mainDialog, final int x, final int y){
            AbstractAction abAction = new AbstractAction() {
                public void actionPerformed(ActionEvent evnt) {
                    mainDialog.setLocation(x, y);
            Timer motionTimer = new Timer(300, abAction);
            motionTimer.setRepeats(false);
            motionTimer.start();
    // Find the taskbar height to place the main frame in lower-right corner
    // of the viewable area of the screen.
        private static int getTrayheight(){
            return (Toolkit.getDefaultToolkit().getScreenSize().height -
                     GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().height);
        }I think my code is clear to you. After moving the dialog onto the task bar, I want to dispose it. You can see that at the end of the while loop I've try it.
    What happened there is, I can't see the dialog moving. it directly dispose. I add a breakpoint at the while loop and check, it iterate until condition is false. But I can't see the motion. If I comment the dispose code line as in my above code, I can see it moving.
    Why is that. Your comment really helpful to me.
    I'm worried is that debugging iterate that while loop but it is not visible. :( :(

    Thanks a lot. I got the point all of you said. But it is bit confusing how to do it.
    As i said in my first post, used slightly similar code to move down the dialog. Here what I have try. But the question is because of my thread used there, it wait little amount to scroll down.
        private void hideWindow(MainDialog mainGialog){
            try{
                int _xAbove = mainGialog.getLocation().x;
                int _yAbove = mainGialog.getLocation().y;
                int _yBelow = mainGialog.getLocation().y + mainGialog.getHeight() + getTrayheight();
                while(_yBelow > _yAbove){
                    dialogScrollingUpDown(this, _xAbove, _yAbove);
                    _yAbove += 1;
                Thread.sleep(1000);
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        try {
                            Thread.sleep(1500);
                            dispose();
                        catch (InterruptedException e) {
                            e.printStackTrace();
            catch (Exception ex) {
                System.out.println(ex.getMessage());
        private void dialogScrollingUpDown(final MainDialog mainDialog, final int x, final int y){
            AbstractAction abAction = new AbstractAction() {
                public void actionPerformed(ActionEvent evnt) {
                    mainDialog.setLocation(x, y);
            Timer motionTimer = new Timer(400, abAction);
            motionTimer.setRepeats(false);
            motionTimer.start();
    // System tray height
        private static int getTrayheight(){
            return (Toolkit.getDefaultToolkit().getScreenSize().height -
                     GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().height);
        }Actually I called the hideWindow method in a button clicked event. After clicked the button, it wait a time equal to the first thread sleep. I can't reduce the time, if so dialog dispose instant.
    Whay I can't do all those things is my IDE not allowed to use frequently changing values in dialogScrollingUpDown method. You can see that in my code.
    Any comments for that.

  • Issues with Swing Timer

    I am currently updating some code in one of my programs. What it currently does is take some parameters and puts those values on a socket for the server to interpet. I then turn on a Swing Timer to listen on the socket for a response from the server. Everytime I get a response, I update a progress bar. That code currently works.
    What I am trying to do now is extend that code. Once the Swing Timer function completes (my progress bar reaches 100%), I want to send another request to the socket to repeat the tasks for a slightly different situation. However, my main function is now checking to see if the timer is finished, which looks like its preventing the timer from executing at all. Any suggestions?
    Some pseudo-code, sorry that I don't have the real thing on me at this current time.
    ListIterator iter = list.listIterator();
    while( iter.hasNext() ) {
    if( !timer.isRunning() ) {
    do stuff
    timer.start();
    Then inside my timer actionListener
    read first byte
    if(byte == 0)
    do stuff
    update Progress Bar
    else
    timer.stop()
    Thanks for any help you can provide.

    This is a guess because your pseudocode is even hard to comprehend...
    A Swing Timer executes on the EDT. If your "main function" is running on the EDT, your timer will never fire and your screen will freeze.
    Even if your main function is not running on the EDT, it seems like you're reading from a Socket within the Timer event, which is on the EDT? If the server is slow or not responding, your GUI will freeze.

  • Swing timer, setDealy issue in bouncing balls

    Hi!
    I have a problem with an assignment with bouncing footballs. There are three classes; footBall which picks a football (soccer)from referencelibrary and here I have a swing timer. The next class is footballfield(fotBollsPlan) that also has a timer in it and an arraylist for the footballs. Here I also have a mouseListener, so every time I click on the footballfield I create a new football. And finally a main-class. So, I click on the panel and create footballs that starts to bounc around inside the frame. Here is the code:
    Football class:
    code
    package uppgift2;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.lang.Thread;
    import java.net.URL;
    import javax.swing.*;
    public class FotBoll implements ActionListener{
         private final int storlek;
         private int x;
         private int xfart;
         private int y;
         private int yfart;
         private FotBollsPlan plan;
         public FotBoll (int x, int y, int xfart, int yfart, int storlek){
              this.storlek = storlek;
              this.x = x;
              this.y = y;
              this.xfart = xfart;
              this.yfart = yfart;
              plan = new FotBollsPlan();
              Timer t = new Timer(100, this);
              t.start();
         public void actionPerformed(ActionEvent ae){
                   if (x < 0 || x > 700)
                        xfart = - xfart;
                   if (y < 0 || y > 500)
                        yfart = - yfart;
                   x = xfart + x;
                   y = yfart + y;
         public void rita(Graphics g){
              ClassLoader cl = this.getClass().getClassLoader();
              URL url = cl.getResource("fotboll" + storlek + ".png");
              Image im = (new javax.swing.ImageIcon(url)).getImage();
              g.drawImage(im, x, y, null );
    Footballfield class:code
    package uppgift2;
    import java.awt.*;
    import java.lang.Thread;
    import java.awt.event.*;
    import static javax.swing.JLabel.*;
    import javax.swing.*;
    public class FotBollsPlan extends JPanel implements MouseListener, ActionListener{
         private java.util.List<FotBoll>fotbollsObjekt;
         private int nrOfBalls;
         private int delay;
         private int loopslot;
         private Timer t;
         private JLabel label = new JLabel();
         public FotBollsPlan(){
         fotbollsObjekt = new java.util.ArrayList<FotBoll>();
         delay = 50;
         t = new Timer(delay, this);
         t.start();
         addMouseListener(this);
    public void paintComponent(Graphics g){
              super.paintComponent(g);
              for (FotBoll fb : fotbollsObjekt){
                   fb.rita(g);
              System.out.println("rita : " + fotbollsObjekt.size());
         public void actionPerformed(ActionEvent ae){
              // An ActionEvent from the timer so we let the timer repaint
              loopslot++;
              System.out.println("loopslot: " + loopslot);
              if(loopslot == 50){
                   //t.stop();
                   delay = 3000;
                   t.setDelay(delay);
                   t.restart();
                   System.out.println("DELAY: " + t.getDelay());
                   repaint();
                   loopslot = 0;
                   System.out.println("XXXX - if sats: " + loopslot);
                   //t.stop();
                   if(delay == 3000){
                        delay = 50;
                   t.setDelay(delay);
                   t.restart();
                   System.out.println("DELAY: " + t.getDelay());
                   //System.out.println("InitialDELAY: " + t.getInitialDelay());
                   repaint();
         public void mouseClicked(MouseEvent me){
              int xfart = (int)(Math.random()*50) - 2;
              int yfart = (int)(Math.random()*50) - 2;
              int storlek = (int)(Math.random()*10) + 1;
              if (me.getButton()== MouseEvent.BUTTON1){
                   FotBoll fb = new FotBoll(me.getX(), me.getY(),xfart, yfart, storlek);
                   fotbollsObjekt.add(fb);
         public void mouseEntered(MouseEvent me) {}
         public void mouseExited(MouseEvent me) {}
         public void mousePressed(MouseEvent me) {}
         public void mouseReleased(MouseEvent me) {}
    code
    code
    Main:
    package uppgift2;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.URL;
    import javax.swing.*;
    public class FotBollMain extends JFrame {
         private FotBoll fb;
         private FotBollsPlan plan1;
    public FotBollMain(){
              setTitle("Test av FotBollsPlan");
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              ClassLoader cl = this.getClass().getClassLoader();
              URL url = cl.getResource("fotbollsplan.png");
                        JLabel label = new JLabel(new ImageIcon(url));
              label.setLayout(new GridLayout(1,1));
                        setSize(800, 600);
              setLocation(25, 25);
                        plan1 = new FotBollsPlan();
              plan1.add(label);
                        add(plan1, BorderLayout.CENTER);
                        setVisible(true);
         public static void main(String[] args)
                        FotBollMain test = new FotBollMain();
    code
    Everything works fine when clicking on the panel and the balls starts to bounce around. But in evenly intervalls the panel should "freeze" for a couple of seconds - showing(painting ) all the balls and then go back again bouncing around. I try to setDelay to 3000 ms which means that for this period of time the panel is "frozen" and then setDelay 50 ms, ie the balls should start bouncing around again. But this doesn't work out. This is the actionPerformed method in the class FotBollsPlan. As you understand I've tried different scenarios but I just can't figure out how to get this to work. The way the code works right now is that if I create four balls, they will all be representing an event and I seem to setDelay for every event not the whole Timer. Does anyone understand this?
    By the way, I don't understand the codetags here.
    Anders

    Hi!
    I have a problem with an assignment with bouncing footballs. There are three classes; footBall which picks a football (soccer)from referencelibrary and here I have a swing timer. The next class is footballfield(fotBollsPlan) that also has a timer in it and an arraylist for the footballs. Here I also have a mouseListener, so every time I click on the footballfield I create a new football. And finally a main-class. So, I click on the panel and create footballs that starts to bounc around inside the frame. Here is the code:
    Football class:
    code
    package uppgift2;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.lang.Thread;
    import java.net.URL;
    import javax.swing.*;
    public class FotBoll implements ActionListener{
         private final int storlek;
         private int x;
         private int xfart;
         private int y;
         private int yfart;
         private FotBollsPlan plan;
         public FotBoll (int x, int y, int xfart, int yfart, int storlek){
              this.storlek = storlek;
              this.x = x;
              this.y = y;
              this.xfart = xfart;
              this.yfart = yfart;
              plan = new FotBollsPlan();
              Timer t = new Timer(100, this);
              t.start();
         public void actionPerformed(ActionEvent ae){
                   if (x < 0 || x > 700)
                        xfart = - xfart;
                   if (y < 0 || y > 500)
                        yfart = - yfart;
                   x = xfart + x;
                   y = yfart + y;
         public void rita(Graphics g){
              ClassLoader cl = this.getClass().getClassLoader();
              URL url = cl.getResource("fotboll" + storlek + ".png");
              Image im = (new javax.swing.ImageIcon(url)).getImage();
              g.drawImage(im, x, y, null );
    Footballfield class:code
    package uppgift2;
    import java.awt.*;
    import java.lang.Thread;
    import java.awt.event.*;
    import static javax.swing.JLabel.*;
    import javax.swing.*;
    public class FotBollsPlan extends JPanel implements MouseListener, ActionListener{
         private java.util.List<FotBoll>fotbollsObjekt;
         private int nrOfBalls;
         private int delay;
         private int loopslot;
         private Timer t;
         private JLabel label = new JLabel();
         public FotBollsPlan(){
         fotbollsObjekt = new java.util.ArrayList<FotBoll>();
         delay = 50;
         t = new Timer(delay, this);
         t.start();
         addMouseListener(this);
    public void paintComponent(Graphics g){
              super.paintComponent(g);
              for (FotBoll fb : fotbollsObjekt){
                   fb.rita(g);
              System.out.println("rita : " + fotbollsObjekt.size());
         public void actionPerformed(ActionEvent ae){
              // An ActionEvent from the timer so we let the timer repaint
              loopslot++;
              System.out.println("loopslot: " + loopslot);
              if(loopslot == 50){
                   //t.stop();
                   delay = 3000;
                   t.setDelay(delay);
                   t.restart();
                   System.out.println("DELAY: " + t.getDelay());
                   repaint();
                   loopslot = 0;
                   System.out.println("XXXX - if sats: " + loopslot);
                   //t.stop();
                   if(delay == 3000){
                        delay = 50;
                   t.setDelay(delay);
                   t.restart();
                   System.out.println("DELAY: " + t.getDelay());
                   //System.out.println("InitialDELAY: " + t.getInitialDelay());
                   repaint();
         public void mouseClicked(MouseEvent me){
              int xfart = (int)(Math.random()*50) - 2;
              int yfart = (int)(Math.random()*50) - 2;
              int storlek = (int)(Math.random()*10) + 1;
              if (me.getButton()== MouseEvent.BUTTON1){
                   FotBoll fb = new FotBoll(me.getX(), me.getY(),xfart, yfart, storlek);
                   fotbollsObjekt.add(fb);
         public void mouseEntered(MouseEvent me) {}
         public void mouseExited(MouseEvent me) {}
         public void mousePressed(MouseEvent me) {}
         public void mouseReleased(MouseEvent me) {}
    code
    code
    Main:
    package uppgift2;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.URL;
    import javax.swing.*;
    public class FotBollMain extends JFrame {
         private FotBoll fb;
         private FotBollsPlan plan1;
    public FotBollMain(){
              setTitle("Test av FotBollsPlan");
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              ClassLoader cl = this.getClass().getClassLoader();
              URL url = cl.getResource("fotbollsplan.png");
                        JLabel label = new JLabel(new ImageIcon(url));
              label.setLayout(new GridLayout(1,1));
                        setSize(800, 600);
              setLocation(25, 25);
                        plan1 = new FotBollsPlan();
              plan1.add(label);
                        add(plan1, BorderLayout.CENTER);
                        setVisible(true);
         public static void main(String[] args)
                        FotBollMain test = new FotBollMain();
    code
    Everything works fine when clicking on the panel and the balls starts to bounce around. But in evenly intervalls the panel should "freeze" for a couple of seconds - showing(painting ) all the balls and then go back again bouncing around. I try to setDelay to 3000 ms which means that for this period of time the panel is "frozen" and then setDelay 50 ms, ie the balls should start bouncing around again. But this doesn't work out. This is the actionPerformed method in the class FotBollsPlan. As you understand I've tried different scenarios but I just can't figure out how to get this to work. The way the code works right now is that if I create four balls, they will all be representing an event and I seem to setDelay for every event not the whole Timer. Does anyone understand this?
    By the way, I don't understand the codetags here.
    Anders

  • Data load to DSO takes long time to finish

    Dear All,
    We have a data load from data source to std  DSO.The data load takes 5 hours to complete  6000 records in single data package which is long time.
    Process monitor shows yellow status at one of the step for long time "No message :Transformation End" and after 5 hours approx  it completes successfully.
    Please find the snapshot of process monitor(Attached File Process monitor.png).
    There is an end routine and the transformation  is having direct mapping except for a target object exchage rate which is master data look up of DSO (Attached FIle : Transformation rule.png)
    The look up DSO /BI0/AFIGL_DS00 in the below code is having DOCNUM as a primary key  but not the POSKY. Since one of the field is not a primary key,secondary index is created for the look up DSO.But,still it takes huge time to finish the last step as mentioned in the snapshot.
    Setting for parallel process is 1
    DTP--> Update tab-->Error handling-->No update,no reporting.But there is a error DTP present which I believe that there is no use when "No update,No reporting" option is chosen.
    Can you please suggest the reason for the such long time.Also,Please suggest how to find the exact place where it consumes lot of time.
    End routine Logic:
        IF NOT RESULT_PACKAGE IS INITIAL.
          REFRESH IT_FIG.
          SELECT DOCNUM  POSKY DEBCRE LOCC
          FROM /BI0/AFIGL_DS00 INTO TABLE IT_FIG
          FOR ALL ENTRIES IN RESULT_PACKAGE
          WHERE DOCNUM = RESULT_PACKAGE-BILNO AND
                POSKY = '02'.
        LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
            READ TABLE IT_FIG INTO WA_FIG WITH KEY
                       DOCNUM = <RESULT_FIELDS>-BILNO.
            IF SY-SUBRC EQ 0.
              <RESULT_FIELDS>-DEB = WA_FIG-DEBCRE.
              <RESULT_FIELDS>-LOC_CURRC2 = WA_FIG-LOCC.
            ENDIF.
        ENDLOOP.
        ENDIF.
    Thanks in advance
    Regards
    Pradeep

    Hi,
    below code check it and try to load the data.
    IF RESULT_PACKAGE IS NOT INITIAL.
          SELECT DOCNUM 
                          POSKY
                          DEBCRE
                          LOCC
          FROM /BI0/AFIGL_DS00 INTO TABLE IT_FIG
          FOR ALL ENTRIES IN RESULT_PACKAGE
          WHERE DOCNUM = RESULT_PACKAGE-BILNO AND
                POSKY = '02'.
        LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
            READ TABLE IT_FIG INTO WA_FIG WITH KEY
                       DOCNUM = <RESULT_FIELDS>-BILNO.
            IF SY-SUBRC EQ 0.
               <RESULT_FIELDS>-DEB = WA_DOCNUM.
               <RESULT_FIELDS>-DEB = WA_POSKY.
              <RESULT_FIELDS>-DEB = WA_FIG-DEBCRE.
              <RESULT_FIELDS>-LOC_CURRC2 = WA_FIG-LOCC.
            ENDIF.
        ENDLOOP.
        ENDIF.
    if your are getting any error please let us know
    1.decrease the data packet size in DTP like 10,000 or 20,000.
    2.increase the parallel process at DTP level.
    Thanks,
    Phani.

  • How can I stop Game Center from opening every time I finish a game?

    I despise Game Center and don't want to use it.  Every time I finish a game of Real Solitaire, Game Center opens and bothers me about not logging in.  This is on an iPad 4/128gb.  I never had this problem until I got the new iPad.  Is there any help, or am I simply going to have to tolerate this unwelcome, unwanted intrusion?

    You can also use the settings in Image Capture to set which devices open/not open specific Applications.
    Open Image Capture from the Application folder and connect the camera or iphone. Once it is detected, you will be presented with an application opening list at the bottom left corner where you can select what happens when that device is connected including iPhoto, iTunes or none. Each device can be configured differently.
    You may also have to go into the FinePix settings and see if there is a setting in that Application to turn off it automatically loading every time the camera is connected.
    Hope this helps

  • HT1577 how do a get a refund on a ridiculously slow downloading rented movie for my apple tv dispite a 5mb/sec down load speed? my first experience with appletv movie rental. no good. rented at 4:30pm. still waiting for standard def movie to finish at 8:1

    how do a get a refund on a ridiculously slow downloading rented movie for my apple tv dispite a >5mb/sec down load speed? my first experience with appletv movie rental. no good. rented at 4:30pm. still waiting for standard def movie to finish at 8:10pm. Not good enough.

    Thanks for the pointers folks. Yeah, 1.5GB is pretty poor isn't it? There are other suppliers, but you have to get a their phone line installed to access the internet so it's an £85 setup fee plus a day off work for a guy to come round and drill a hole in your wall before you even get to the monthly costs.
    Don't get me wrong though - I'm certainly not an Apple basher, but am equally frustrated with both them and the ISP.
    Virgin Media spend all kinds of money advertising their broadband as the fastest in the UK, but don't tell you (up front anyway) that you'll be cut off if you actually try and use it.
    Apple on the other hand carry on with their 'it just works' mantra, but with Apple TV this only applies if you meet certain criteria (again, not mentioned up front).
    I guess it aint a biggie, as i was gifted my Apple TV, and love all the other stuff it does, but from the number of posts on this forum can see that there's a lot of angry customers out there who want explanations as to why they're having similar problems to me.
    Will be very interesting to see if Apple release any kind of software update that turns the flash drive from a buffer to permanent storage, to at least ease some of the pain...
    Message was edited by: McGinty

  • How to stop swing timer

    Hello,
    I use Swing timer in my application but it seems that timer.stop() does not work. I put System.out.println("hello") in the method that is the timer's actionlistener and even after I call timer.stop(), it keeps printing "hello". Is there any thing other than timer.stop() that I should do to stop the timer?
    Thanks a lot

    ladybean wrote:
    Thanks a lot for your reply. Well I only have one timer in the code. Another funny thing that is happening is that the timer gets faster over time. As you and I both know, this shouldn't be happening. I believe that you have one Timer variable, but are you sure that you don't have more than one Timer object? Again, this is just a SWAG, but this would also explain the increased speed over time.
    I set the delay time of 1 second but I see that my animation moves faster over time. The reason that I don't upload code is that it's really long and complicated. Maybe I should make it simpler and upload it. This is a very very good idea. We have a construct that's often used here called a SSCCE or "Short, Self Contained, Correct (Compilable), Example" that helps guide folks in creating a small compilable and runnable version of their problem, and often helps them to see their error for themselves (there's a lot to be said for simplifying the problem to examine it). Please have a look at this link for more details: [http://sscce.org/]
    Thanks again though. :)You're welcome. Oh, and if you do resolve this on your own, please post back to let us know what happened and why. Best of luck!

  • How do I stop and start a Swing Timer?

    I have created a Swing timer;
            new Timer(250, Task).start();but can't figure out how to use the .stop() and .restart() methods?
    How do I code this?
    TIA

    I found the answer;
      SimKitsControlTimer = new Timer(250, SimKitsControlTask);
      SimKitsControlTimer.start();Not as prevously written.
    I was trying to create an object with the .start() method at the end of the line. Doh!

  • SCOM Alert Connector - not updating the start time and finish time

    When I am monitoring the status of connectors in service manager console, I found that for SCOM Alert Connector the Start Time and Finish Time are not updating. Previously it was updated daily. As of now, service manager is working fine but would like
    to check will it create any issues? Even I have cliked on Synchronize Now, but there is no update. Please guide me on this to trouble shoot further? Thanks.

    Hi,
    Based on my research, the Start Time and Finish Time values are not updated when an alert connector is synchronized. These values are only updated when alert data is transferred between Operations Manager 2007 and Service
    Manager.
    More details, please refer to the link below:
    http://technet.microsoft.com/en-us/library/hh495609.aspx
    In addition, here is a blog about troubleshooting for SCSM and SCOM alert connector:
    http://blogs.technet.com/b/servicemanager/archive/2010/04/14/troubleshooting-tips-for-your-scsm-scom-alert-connector.aspx
    Regards,
    Yan Li
    Regards, Yan Li

  • How to kill all swing.Timer(s) at end of App

    I am using a javax.swing.Timer to cause text to flash in the text field. However, I noticed that if this timer is running when I stop my app, the timer's thread is still running. It appears that the class that has the timer is not being garbage collected immediately upon application exit. Is there a way to kill all swing timers?
    Thanks,
    John

    No. This is a class whose implementation I was hoping the main application would not have to know about. I was hoping that since I was using swing timers that when the application on which thread the swing timers are executing exited, all the swing timers attached to that application would be stopped.
    Do you have a suggestion how I might be able to do this? I have an application "A" that uses a library class "B" method that happens to start a timer. I do not want "A" to have to explicitly stop "B" when the application is ending. Is there a way I can tag the timer so that it will stop when "A" exits? Or could I somehow link "B" to "A" so that a dispose method on "B" is called when "A" exits or disposes?
    Thanks,
    John

  • HT5538 My facetime and imessage aint working now, when i try to turn it on, it says waiting for activation then when it finishes it says something to do with a network connection. help me!!!

    My facetime and imessage aint working now, when i try to turn it on, it says waiting for activation then when it finishes it says something to do with a network connection. help me!!!

    iOS: Troubleshooting FaceTime and iMessage activation

  • HT4479 How long do i have to wait befor my face time is active

    How long do i have to wait befor my face time is active

    Hello SassyMurad,
    Thank you for the details of the iMessage issue you are experiencing.  I recommend following the steps in this article when you are not able to activate iMessage on your iPod touch:
    iOS: Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/ts4268
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Help ! inaccurate time recorded using javax.swing.timer

    Hi All,
    I am currently trying to write a stopwatch for timing application events such as loggon, save, exit ... for this I have created a simple Swing GUI and I am using the javax.swing.timer and updating a the time on a Jlabel. The trouble that I am having is that the time is out by up to 20 seconds over a 10 mins. Is there any way to get a more accruate time ?? The code that I am using is attached below.
    private Timer run = new Timer(1000, new ActionListener() {
    public void actionPerformed(ActionEvent evt) {
    timeTaken.setText("<html><font size = 5><b>" + (df.format(timeHours)) + ":" + (df.format(timeMins)) + ":"
    + (df.format(timeSeconds++)) + "</b></font><html>");
    receordedTimeValue = ((df.format(timeHours)) + ":" + (df.format(timeMins)) + ":"
    + (df.format(timeSeconds)));
    if (timeSeconds == 60) {
    timeMins++;
    timeSeconds = 0;
    if (timeMins == 60) {
    timeHours++;
    timeMins = 0;

    To get more accurate time you should use the System.currentTimeMillis() method.
    Try this code :
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class CountUpLabel extends JLabel{
         javax.swing.Timer timer;
         long startTime, count;
         public CountUpLabel() {
              super(" ", SwingConstants.CENTER);
              timer = new javax.swing.Timer(500, new ActionListener() { // less than or equal to 1000 (1000, 500, 250,200,100) 
                   public void actionPerformed(ActionEvent event) {
                        if (startTime == -1) {          
                             count = 0;               
                             startTime = System.currentTimeMillis();
                        else {
                             count = System.currentTimeMillis()-startTime;
                        setText(getStringTime(count));
         private static final String getStringTime(long millis) {
              int seconds = (int)(millis/1000);
              int minutes = (int)(seconds/60);
              int hours = (int)(minutes/60);
              minutes -= hours*60;
              seconds -= (hours*3600)+(minutes*60);
              return(((hours<10)?"0"+hours:""+hours)+":"+((minutes<10)?"0"+minutes:""+minutes)+":"+((seconds<10)?"0"+seconds:""+seconds));
         public void start() {
              startTime = -1;
              timer.setInitialDelay(0);
              timer.start();
         public long stop() {
              timer.stop();
              return(count);
         public static void main(String[] args) {
              JFrame frame = new JFrame("Countdown");
              CountUpLabel countUp = new CountUpLabel();
              frame.getContentPane().add(countUp, BorderLayout.CENTER);
              frame.setBounds(200,200,200,100);
              frame.setVisible(true);
              countUp.start();
    Denis

Maybe you are looking for

  • How to turn on my ipad

    Guys, can someone help me?  I was watching movie on my iPad and suddenly I felt asleep. When I woke up, I couldn't turn the iPad back on, even went I plugged it. The screen was left  completely plain without. What can i do to get this

  • Save query output in file

    Hi, I want to save the output of a query in a text file. I have the code to save text in a file using util_file package but i dont know how to use the same code for my query May be if i use cursors it will help but i m not getting the logic. my query

  • Spry Tabbed Panel 2.0 Suggestions/Questions

    I've been starting to play around with the Widget Browser on CS4 & CS5 and I am just noticing a few things that I think need to be looked at. 1. I am starting to understand your process for the UI (I actually never realized that was there at first, b

  • JTable column auto-maximum width

    Hi, Does anyone have an idea on how to make the JTable to support column auto-maximum width resize, like we always see in a microsoft's table component, you double click on the column seperater and the column resized to its maximum size according to

  • Will you explain the meaning of, adding a astrisc (*) before a variable

    Hi All, Will you explain the meaning of, adding a astrisc (*) before a variable. ex: *var1, *var2.