95 *progressBar.setIndeterminate(false);
96 *</pre>
97 *
98 * <p>
99 *
100 * For complete examples and further documentation see
101 * <a href="https://docs.oracle.com/javase/tutorial/uiswing/components/progress.html" target="_top">How to Monitor Progress</a>,
102 * a section in <em>The Java Tutorial.</em>
103 *
104 * <p>
105 * <strong>Warning:</strong> Swing is not thread safe. For more
106 * information see <a
107 * href="package-summary.html#threading">Swing's Threading
108 * Policy</a>.
109 * <p>
110 * <strong>Warning:</strong>
111 * Serialized objects of this class will not be compatible with
112 * future Swing releases. The current serialization support is
113 * appropriate for short term storage or RMI between applications running
114 * the same version of Swing. As of 1.4, support for long term storage
115 * of all JavaBeans™
116 * has been added to the <code>java.beans</code> package.
117 * Please see {@link java.beans.XMLEncoder}.
118 *
119 * @see javax.swing.plaf.basic.BasicProgressBarUI
120 * @see javax.swing.BoundedRangeModel
121 * @see javax.swing.SwingWorker
122 *
123 * @author Michael C. Albers
124 * @author Kathy Walrath
125 * @since 1.2
126 */
127 @JavaBean(defaultProperty = "UI", description = "A component that displays an integer value.")
128 @SwingContainer(false)
129 @SuppressWarnings("serial") // Same-version serialization only
130 public class JProgressBar extends JComponent implements SwingConstants, Accessible
131 {
132 /**
133 * @see #getUIClassID
134 */
135 private static final String uiClassID = "ProgressBarUI";
609 *
610 * @return the string "ProgressBarUI"
611 * @see JComponent#getUIClassID
612 * @see UIDefaults#getUI
613 */
614 @BeanProperty(bound = false, expert = true, description
615 = "A string that specifies the name of the look-and-feel class.")
616 public String getUIClassID() {
617 return uiClassID;
618 }
619
620
621 /* We pass each Change event to the listeners with the
622 * the progress bar as the event source.
623 * <p>
624 * <strong>Warning:</strong>
625 * Serialized objects of this class will not be compatible with
626 * future Swing releases. The current serialization support is
627 * appropriate for short term storage or RMI between applications running
628 * the same version of Swing. As of 1.4, support for long term storage
629 * of all JavaBeans™
630 * has been added to the <code>java.beans</code> package.
631 * Please see {@link java.beans.XMLEncoder}.
632 */
633 @SuppressWarnings("serial") // Same-version serialization only
634 private class ModelListener implements ChangeListener, Serializable {
635 public void stateChanged(ChangeEvent e) {
636 fireStateChanged();
637 }
638 }
639
640 /**
641 * Subclasses that want to handle change events
642 * from the model differently
643 * can override this to return
644 * an instance of a custom <code>ChangeListener</code> implementation.
645 * The default {@code ChangeListener} simply calls the
646 * {@code fireStateChanged} method to forward {@code ChangeEvent}s
647 * to the {@code ChangeListener}s that have been added directly to the
648 * progress bar.
649 *
986 @BeanProperty(bound = false, expert = true, description
987 = "The AccessibleContext associated with this ProgressBar.")
988 public AccessibleContext getAccessibleContext() {
989 if (accessibleContext == null) {
990 accessibleContext = new AccessibleJProgressBar();
991 }
992 return accessibleContext;
993 }
994
995 /**
996 * This class implements accessibility support for the
997 * <code>JProgressBar</code> class. It provides an implementation of the
998 * Java Accessibility API appropriate to progress bar user-interface
999 * elements.
1000 * <p>
1001 * <strong>Warning:</strong>
1002 * Serialized objects of this class will not be compatible with
1003 * future Swing releases. The current serialization support is
1004 * appropriate for short term storage or RMI between applications running
1005 * the same version of Swing. As of 1.4, support for long term storage
1006 * of all JavaBeans™
1007 * has been added to the <code>java.beans</code> package.
1008 * Please see {@link java.beans.XMLEncoder}.
1009 */
1010 @SuppressWarnings("serial") // Same-version serialization only
1011 protected class AccessibleJProgressBar extends AccessibleJComponent
1012 implements AccessibleValue {
1013
1014 /**
1015 * Gets the state set of this object.
1016 *
1017 * @return an instance of AccessibleState containing the current state
1018 * of the object
1019 * @see AccessibleState
1020 */
1021 public AccessibleStateSet getAccessibleStateSet() {
1022 AccessibleStateSet states = super.getAccessibleStateSet();
1023 if (getModel().getValueIsAdjusting()) {
1024 states.add(AccessibleState.BUSY);
1025 }
1026 if (getOrientation() == VERTICAL) {
|
95 *progressBar.setIndeterminate(false);
96 *</pre>
97 *
98 * <p>
99 *
100 * For complete examples and further documentation see
101 * <a href="https://docs.oracle.com/javase/tutorial/uiswing/components/progress.html" target="_top">How to Monitor Progress</a>,
102 * a section in <em>The Java Tutorial.</em>
103 *
104 * <p>
105 * <strong>Warning:</strong> Swing is not thread safe. For more
106 * information see <a
107 * href="package-summary.html#threading">Swing's Threading
108 * Policy</a>.
109 * <p>
110 * <strong>Warning:</strong>
111 * Serialized objects of this class will not be compatible with
112 * future Swing releases. The current serialization support is
113 * appropriate for short term storage or RMI between applications running
114 * the same version of Swing. As of 1.4, support for long term storage
115 * of all JavaBeans
116 * has been added to the <code>java.beans</code> package.
117 * Please see {@link java.beans.XMLEncoder}.
118 *
119 * @see javax.swing.plaf.basic.BasicProgressBarUI
120 * @see javax.swing.BoundedRangeModel
121 * @see javax.swing.SwingWorker
122 *
123 * @author Michael C. Albers
124 * @author Kathy Walrath
125 * @since 1.2
126 */
127 @JavaBean(defaultProperty = "UI", description = "A component that displays an integer value.")
128 @SwingContainer(false)
129 @SuppressWarnings("serial") // Same-version serialization only
130 public class JProgressBar extends JComponent implements SwingConstants, Accessible
131 {
132 /**
133 * @see #getUIClassID
134 */
135 private static final String uiClassID = "ProgressBarUI";
609 *
610 * @return the string "ProgressBarUI"
611 * @see JComponent#getUIClassID
612 * @see UIDefaults#getUI
613 */
614 @BeanProperty(bound = false, expert = true, description
615 = "A string that specifies the name of the look-and-feel class.")
616 public String getUIClassID() {
617 return uiClassID;
618 }
619
620
621 /* We pass each Change event to the listeners with the
622 * the progress bar as the event source.
623 * <p>
624 * <strong>Warning:</strong>
625 * Serialized objects of this class will not be compatible with
626 * future Swing releases. The current serialization support is
627 * appropriate for short term storage or RMI between applications running
628 * the same version of Swing. As of 1.4, support for long term storage
629 * of all JavaBeans
630 * has been added to the <code>java.beans</code> package.
631 * Please see {@link java.beans.XMLEncoder}.
632 */
633 @SuppressWarnings("serial") // Same-version serialization only
634 private class ModelListener implements ChangeListener, Serializable {
635 public void stateChanged(ChangeEvent e) {
636 fireStateChanged();
637 }
638 }
639
640 /**
641 * Subclasses that want to handle change events
642 * from the model differently
643 * can override this to return
644 * an instance of a custom <code>ChangeListener</code> implementation.
645 * The default {@code ChangeListener} simply calls the
646 * {@code fireStateChanged} method to forward {@code ChangeEvent}s
647 * to the {@code ChangeListener}s that have been added directly to the
648 * progress bar.
649 *
986 @BeanProperty(bound = false, expert = true, description
987 = "The AccessibleContext associated with this ProgressBar.")
988 public AccessibleContext getAccessibleContext() {
989 if (accessibleContext == null) {
990 accessibleContext = new AccessibleJProgressBar();
991 }
992 return accessibleContext;
993 }
994
995 /**
996 * This class implements accessibility support for the
997 * <code>JProgressBar</code> class. It provides an implementation of the
998 * Java Accessibility API appropriate to progress bar user-interface
999 * elements.
1000 * <p>
1001 * <strong>Warning:</strong>
1002 * Serialized objects of this class will not be compatible with
1003 * future Swing releases. The current serialization support is
1004 * appropriate for short term storage or RMI between applications running
1005 * the same version of Swing. As of 1.4, support for long term storage
1006 * of all JavaBeans
1007 * has been added to the <code>java.beans</code> package.
1008 * Please see {@link java.beans.XMLEncoder}.
1009 */
1010 @SuppressWarnings("serial") // Same-version serialization only
1011 protected class AccessibleJProgressBar extends AccessibleJComponent
1012 implements AccessibleValue {
1013
1014 /**
1015 * Gets the state set of this object.
1016 *
1017 * @return an instance of AccessibleState containing the current state
1018 * of the object
1019 * @see AccessibleState
1020 */
1021 public AccessibleStateSet getAccessibleStateSet() {
1022 AccessibleStateSet states = super.getAccessibleStateSet();
1023 if (getModel().getValueIsAdjusting()) {
1024 states.add(AccessibleState.BUSY);
1025 }
1026 if (getOrientation() == VERTICAL) {
|