Logo Search packages:      
Sourcecode: libjgoodies-animation-java version File versions  Download package

synchronized void com::jgoodies::animation::components::AnimatedLabel::setText ( String  newText  )  [inline]

Sets a new text. If the animation is disabled the text will be set immediately otherwise a blend over animation is used.

Parameters:
newText the new text to be displayed

Definition at line 264 of file AnimatedLabel.java.

References animation(), getText(), isAnimated(), setTextImmediately(), com::jgoodies::animation::Animator::start(), and com::jgoodies::animation::Animator::stop().

                                                     {
        String oldText = getText();
        if (oldText.equals(newText))
            return;
        
        if (!isAnimated()) {
            setTextImmediately(newText);
            return;
        } 
        
        labels[background].setText(newText);
        foreground = 1 - foreground;
        background = 1 - background;
        // Ensure a previous animation is stopped before we start a new one.
        if (animator != null) {
            animator.stop();
        }
        animator = new Animator(animation(), fps);
        animator.start();
        firePropertyChange(PROPERTYNAME_TEXT, oldText, newText);
    }


Generated by  Doxygen 1.6.0   Back to index