Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


#Actual0Circle0

Posted 19 February 2013 - 11:27 AM

ActionListener listener = new ActionListener()
        {
            @Override public void actionPerformed(ActionEvent e)
            {
                boolean isfin = false;
                do {
                    NSplitFrame += NSplitFrameInc;
                    if (NSplitFrame < 4 || NSplitFrame > 12)
                    {
                        NSplitFrame = 8;
                        NSplitFrameInc = -NSplitFrameInc;
                    }
                }while(isfin);
            }
        };
        displayTimer = new Timer(200, listener);
        displayTimer.start();

with or without the do :: while every once in a while I get a ArrayOutOfBoundsException due to NSplitFrame being > 12. Is there a way to make sure that this listener has completely finished while the values are being changed?


#10Circle0

Posted 19 February 2013 - 10:42 AM

ActionListener listener = new ActionListener()
        {
            @Override public void actionPerformed(ActionEvent e)
            {
                boolean isfin = false;
                do {
                    NSplitFrame += NSplitFrameInc;
                    if (NSplitFrame < 4 || NSplitFrame > 12)
                    {
                        NSplitFrame = 8;
                        NSplitFrameInc = -NSplitFrameInc;
                    }
                }while(isfin);
            }
        };
        displayTimer = new Timer(200, listener);
        displayTimer.start();

without the do :: while every once in a while I get a ArrayOutOfBoundsException due to NSplitFrame being > 12. Is the do :: while the best way to make sure that this listener has completely finished while the values are being changed?


PARTNERS