Class ThrobberUI

    • Field Detail

      • TIMER_KEY

        protected static String TIMER_KEY
      • PERIOD_KEY

        public static final String PERIOD_KEY
        An optional client property to define the period of this animation (if the animation has a period).
      • PERIOD_MULTIPLIER_KEY

        public static final String PERIOD_MULTIPLIER_KEY
        An optional client property to slow the default period by a fixed interval.
      • repaintInterval

        protected final int repaintInterval
    • Constructor Detail

      • ThrobberUI

        protected ThrobberUI(int repaintInterval)
        Parameters:
        repaintInterval - The number of milliseconds between repaints.
    • Method Detail

      • getPeriod

        public int getPeriod(JComponent jc,
                             int defaultPeriod)
        Return the period (in milliseconds) of this throbber.

        This is a convenience method that takes the argument defaultPeriod and modifies it according to PERIOD_KEY or PERIOD_MULTIPLIER_KEY

        Parameters:
        jc - the component to inspect. If null then the default period is immediately returned.
        defaultPeriod - the value to return if no customizations are defined..
      • paint

        protected void paint(Graphics g0,
                             JComponent jc,
                             Float fixedFraction)
        Parameters:
        g0 -
        jc - the component may be null
        fixedFraction - an optional fixed fraction from [0, 1] representing the state of this animation. If null: then this should be derived from the current time.
      • paintBackground

        protected void paintBackground(Graphics2D g,
                                       JComponent jc)
        Paint the background color, if the argument is opaque.
      • paintForeground

        protected abstract void paintForeground(Graphics2D g,
                                                JComponent jc,
                                                Dimension size,
                                                Float fixedFraction)
        Paints the foreground. The Graphics2D passed to this object is configured as if you were painting size argument (which is the preferred size). So if the preferred size of this ThrobberUI is 16x16, you always paint as if you're painting to a 16x16 area.
        Parameters:
        g - the graphics to paint to.
        jc - the component to paint, this may be null if used as an Icon.
        size - the dimensions to paint to. Assume these are the dimensions of the component you are painting (the Graphics2D has been transformed to work within these dimensions).
        fixedFraction - an optional fixed fraction from [0, 1] representing the state of this animation. If null: then this should be derived from the current time.
      • getDefaultForeground

        public abstract Color getDefaultForeground()
        Return the default foreground color for this throbber. If this is not null: then during installUI() this will be assigned as the new foreground color.
      • getPreferredSize

        public abstract Dimension getPreferredSize()
      • uninstallUI

        public void uninstallUI(JComponent c)
      • createIcon

        public Icon createIcon(Float fixedFraction,
                               Dimension size)
        Create an Icon representation of this ThrobberUI.
        Parameters:
        fixedFraction - the fraction from [0,1] indicating this icon's animation progress, or null if this icon should update based on System.currentTimeMillis().
        size - the dimensions of this icon, or null if the default size should be used.