Class JThrobber

  • All Implemented Interfaces:
    ImageObserver, MenuContainer, Serializable


    public class JThrobber
    extends JComponent
    This is a simple animated component used to indicate activity when a JProgressBar is either not useful (because a task is indeterminate) or too large (because a task must be expressed in a tiny amount of space). Here are some possible UI implementations:

    Sample of AquaThrobberUI Sample of ChasingArrowsThrobberUI Sample of PulsingCirclesThrobberUI

    Apple's OSX Human Interface Guidelines call this an "Asynchronous Progress Indicator", and describe it as follows:

    An asynchronous progress indicator provides feedback on an ongoing process.

    Asynchronous progress indicators are available in Interface Builder. In the Attributes pane of the inspector, select Spinning for the style and be sure the Indeterminate checkbox is selected. To create an asynchronous progress indicator using AppKit programming interfaces, use the NSProgressIndicator class with style NSProgressIndicatorSpinningStyle.

    Appearance and Behavior

    The appearance of the asynchronous progress indicator is provided automatically. The asynchronous progress indicator always spins at the same rate.

    Guidelines

    Use an asynchronous progress indicator when space is very constrained, such as in a text field or near a control. Because this indicator is small and unobtrusive, it is especially useful for asynchronous events that take place in the background, such as retrieving messages from a server.

    If the process might change from indeterminate to determinate, start with an indeterminate progress bar. You don't want to start with an asynchronous progress indicator because the determinate progress bar is a different shape and takes up much more space. Similarly, if the process might change from indeterminate to determinate, use an indeterminate progress bar instead of an asynchronous progress indicator, because it is the same shape and size as the determinate progress bar.

    In general, avoid supplying a label. Because an asynchronous progress indicator typically appears when the user initiates a process, a label is not usually necessary. If you decide to provide a label that appears with the indicator, create a complete or partial sentence that briefly describes the process that is occurring. You should use sentence-style capitalization (for more information on this style, see "Capitalizing Labels and Text") and you can end the label with an ellipsis (...) to emphasize the ongoing nature of the processing.

    Alternatively, Wikipedia describes a throbber as:

    A throbber is a graphic found in a graphical user interface of a computer program that animates to show the user that the program is performing an action in the background (such as downloading content, conducting intensive calculations or communicating with an external device). In contrast to a progress bar, a throbber does not convey how much of the action has been completed.
    See Also:
    com.bric.swing.JThrobberDemo, Serialized Form
    • Field Detail

      • KEY_ACTIVE

        public static final String KEY_ACTIVE
    • Constructor Detail

      • JThrobber

        public JThrobber()
    • Method Detail

      • getUIClassID

        public String getUIClassID()
      • updateUI

        public void updateUI()
      • isActive

        public boolean isActive()
      • setActive

        public void setActive(boolean b)
        An inactive throbber doesn't paint itself. This is sometimes useful (instead of simply toggling the visibility of this throbber on/off) because it maintains the same size in the UI, so other elements won't constantly shift around but the widget can still effectively be hidden.