Class ProgressBar

All Implemented Interfaces:
Styleable, EventTarget, Skinnable

public class ProgressBar
extends ProgressIndicator
A specialization of the ProgressIndicator which is represented as a horizontal bar.

ProgressBar sets focusTraversable to false.

This first example creates a ProgressBar with an indeterminate value:

 ProgressBar p1 = new ProgressBar();
Image of the indeterminate progress ProgressBar control

This next example creates a ProgressBar which is 25% complete:

 ProgressBar p2 = new ProgressBar();
 p2.setProgress(0.25F);
Image of the ProgressBar control
Since:
JavaFX 2.0
  • Constructor Details

    • ProgressBar

      public ProgressBar()
      Creates a new indeterminate ProgressBar.
    • ProgressBar

      public ProgressBar​(double progress)
      Creates a new ProgressBar with the given progress value.
      Parameters:
      progress - the progress, represented as a value between 0 and 1
  • Method Details

    • createDefaultSkin

      protected Skin<?> createDefaultSkin()
      Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).
      Overrides:
      createDefaultSkin in class ProgressIndicator
      Returns:
      new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.
    • getInitialFocusTraversable

      protected Boolean getInitialFocusTraversable()
      Returns the initial focus traversable state of this control, for use by the JavaFX CSS engine to correctly set its initial value. This method is overridden as by default UI controls have focus traversable set to true, but that is not appropriate for this control.
      Overrides:
      getInitialFocusTraversable in class ProgressIndicator
      Returns:
      the initial focus traversable state of this control
      Since:
      9
    • queryAccessibleAttribute

      public Object queryAccessibleAttribute​(AccessibleAttribute attribute, Object... parameters)
      This method is called by the assistive technology to request the value for an attribute.

      This method is commonly overridden by subclasses to implement attributes that are required for a specific role.
      If a particular attribute is not handled, the superclass implementation must be called.

      Overrides:
      queryAccessibleAttribute in class ProgressIndicator
      Parameters:
      attribute - the requested attribute
      parameters - optional list of parameters
      Returns:
      the value for the requested attribute
      See Also:
      AccessibleAttribute