2362N/A * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A/** A class to monitor the progress of some operation. If it looks 0N/A * like the operation will take a while, a progress dialog will be popped up. 0N/A * When the ProgressMonitor is created it is given a numeric range and a 0N/A * descriptive string. As the operation progresses, call the setProgress method 0N/A * to indicate how far along the [min,max] range the operation is. 0N/A * Initially, there is no ProgressDialog. After the first millisToDecideToPopup 0N/A * milliseconds (default 500) the progress monitor will predict how long 0N/A * the operation will take. If it is longer than millisToPopup (default 2000, 0N/A * 2 seconds) a ProgressDialog will be popped up. 0N/A * From time to time, when the Dialog box is visible, the progress bar will 0N/A * be updated when setProgress is called. setProgress won't always update 0N/A * the progress bar, it will only be done if the amount of progress is 0N/A * visibly significant. 0N/A * For further documentation and examples see 0N/A * a section in <em>The Java Tutorial.</em> 0N/A * @see ProgressMonitorInputStream 0N/A * @author James Gosling 0N/A * @author Lynn Monsanto (accessibility) 0N/A * Constructs a graphic object that shows progress, typically by filling 0N/A * in a rectangular bar as the process nears completion. 0N/A * @param parentComponent the parent component for the dialog box 0N/A * @param message a descriptive message that will be shown 0N/A * to the user to indicate what operation is being monitored. 0N/A * This does not change as the operation progresses. 0N/A * See the message parameters to methods in 0N/A * {@link JOptionPane#message} 0N/A * for the range of values. 0N/A * @param note a short note describing the state of the 0N/A * operation. As the operation progresses, you can call 0N/A * setNote to change the note displayed. This is used, 0N/A * for example, in operations that iterate through a 0N/A * list of files to show the name of the file being processes. 0N/A * If note is initially null, there will be no note line 0N/A * in the dialog box and setNote will be ineffective 0N/A * @param min the lower bound of the range 0N/A * @param max the upper bound of the range 0N/A // Equivalent to JOptionPane.createDialog, 0N/A // but create a modeless dialog. 0N/A // This is necessary because the Solaris implementation doesn't 0N/A // support Dialog.setModal yet. 0N/A // Once window gets focus, set initial focus 0N/A // Accessibility support for ProgressOptionPane 0N/A * Gets the AccessibleContext for the ProgressOptionPane 0N/A * @return the AccessibleContext for the ProgressOptionPane 0N/A * Returns the AccessibleJOptionPane 0N/A * Indicate the progress of the operation being monitored. 0N/A * If the specified value is >= the maximum, the progress 0N/A * monitor is closed. 0N/A * @param nv an int specifying the current value, between the 0N/A * maximum and minimum specified for this component 0N/A "ProgressMonitor.progressText"));
0N/A * Indicate that the operation is complete. This happens automatically 0N/A * when the value set by setProgress is >= max, but it may be called 0N/A * earlier if the operation ends early. 0N/A * Returns the minimum value -- the lower end of the progress value. 0N/A * @return an int representing the minimum value 0N/A * Specifies the minimum value. 0N/A * @param m an int specifying the minimum value 0N/A * Returns the maximum value -- the higher end of the progress value. 0N/A * @return an int representing the maximum value 0N/A * Specifies the maximum value. 0N/A * @param m an int specifying the maximum value 0N/A * Returns true if the user hits the Cancel button in the progress dialog. 0N/A * Specifies the amount of time to wait before deciding whether or 0N/A * not to popup a progress monitor. 0N/A * @param millisToDecideToPopup an int specifying the time to wait, 0N/A * @see #getMillisToDecideToPopup 0N/A * Returns the amount of time this object waits before deciding whether 0N/A * or not to popup a progress monitor. 0N/A * @see #setMillisToDecideToPopup 0N/A * Specifies the amount of time it will take for the popup to appear. 0N/A * (If the predicted time remaining is less than this time, the popup 0N/A * won't be displayed.) 0N/A * @param millisToPopup an int specifying the time in milliseconds 0N/A * @see #getMillisToPopup 0N/A * Returns the amount of time it will take for the popup to appear. 0N/A * @see #setMillisToPopup 0N/A * Specifies the additional note that is displayed along with the 0N/A * progress message. Used, for example, to show which file the 0N/A * is currently being copied during a multiple-file copy. 0N/A * @param note a String specifying the note to display 0N/A * Specifies the additional note that is displayed along with the 0N/A * @return a String specifying the note to display 0N/A // Accessibility support 0N/A * The <code>AccessibleContext</code> for the <code>ProgressMonitor</code> 0N/A * Gets the <code>AccessibleContext</code> for the 0N/A * <code>ProgressMonitor</code> 0N/A * @return the <code>AccessibleContext</code> for the 0N/A * <code>ProgressMonitor</code> 0N/A // Notify the AccessibleProgressMonitor that the 0N/A // ProgressOptionPane was created. It is necessary 0N/A // to poll for ProgressOptionPane creation because 0N/A // the ProgressMonitor does not have a Component 0N/A // to add a listener to until the ProgressOptionPane 0N/A * <code>AccessibleProgressMonitor</code> implements accessibility 0N/A * support for the <code>ProgressMonitor</code> class. 0N/A * The accessibility hierarchy for ProgressMonitor is a flattened 0N/A * version of the ProgressOptionPane component hierarchy. 0N/A * The ProgressOptionPane component hierarchy is: 0N/A * ProgressOptionPane 0N/A * The AccessibleProgessMonitor accessibility hierarchy is: 0N/A * AccessibleProgressMonitor 0N/A * AccessibleJProgressBar 0N/A * The abstraction presented to assitive technologies by 0N/A * the AccessibleProgressMonitor is that a dialog contains a 0N/A * progress monitor with three children: a message, a note 0N/A * label and a progress bar. 0N/A * AccessibleProgressMonitor constructor 0N/A * Initializes the AccessibleContext now that the ProgressOptionPane 0N/A * has been created. Because the ProgressMonitor is not a Component 0N/A * implementing the Accessible interface, an AccessibleContext 0N/A * must be synthesized from the ProgressOptionPane and its children. 0N/A * For other AWT and Swing classes, the inner class that implements 0N/A * accessibility for the class extends the inner class that implements 0N/A * implements accessibility for the super class. AccessibleProgressMonitor 0N/A * cannot extend AccessibleJOptionPane and must therefore delegate calls 0N/A * to the AccessibleJOptionPane. 0N/A // add a listener for progress bar ChangeEvents 0N/A // add a listener for note label PropertyChangeEvents 0N/A * Invoked when the target of the listener has changed its state. 0N/A * @param e a <code>ChangeEvent</code> object. Must not be null. 0N/A * @throws NullPointerException if the parameter is null. 0N/A // the progress bar value changed 0N/A * This method gets called when a bound property is changed. 0N/A * @param e A <code>PropertyChangeEvent</code> object describing 0N/A * the event source and the property that has changed. Must not be null. 0N/A * @throws NullPointerException if the parameter is null. 0N/A // the note label text changed 0N/A /* ===== Begin AccessileContext ===== */ 0N/A * Gets the accessibleName property of this object. The accessibleName 0N/A * property of an object is a localized String that designates the purpose 0N/A * of the object. For example, the accessibleName property of a label 0N/A * or button might be the text of the label or button itself. In the 0N/A * case of an object that doesn't display its name, the accessibleName 0N/A * should still be set. For example, in the case of a text field used 0N/A * to enter the name of a city, the accessibleName for the en_US locale 0N/A * @return the localized name of the object; null if this 0N/A * object does not have a name 0N/A * @see #setAccessibleName 0N/A // delegate to the AccessibleJOptionPane 0N/A * Gets the accessibleDescription property of this object. The 0N/A * accessibleDescription property of this object is a short localized 0N/A * phrase describing the purpose of the object. For example, in the 0N/A * case of a 'Cancel' button, the accessibleDescription could be 0N/A * 'Ignore changes and close dialog box.' 0N/A * @return the localized description of the object; null if 0N/A * this object does not have a description 0N/A * @see #setAccessibleDescription 0N/A // delegate to the AccessibleJOptionPane 0N/A * Gets the role of this object. The role of the object is the generic 0N/A * purpose or use of the class of this object. For example, the role 0N/A * of a push button is AccessibleRole.PUSH_BUTTON. The roles in 0N/A * AccessibleRole are provided so component developers can pick from 0N/A * a set of predefined roles. This enables assistive technologies to 0N/A * provide a consistent interface to various tweaked subclasses of 0N/A * components (e.g., use AccessibleRole.PUSH_BUTTON for all components 0N/A * that act like a push button) as well as distinguish between sublasses 0N/A * that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes 0N/A * and AccessibleRole.RADIO_BUTTON for radio buttons). 0N/A * <p>Note that the AccessibleRole class is also extensible, so 0N/A * custom component developers can define their own AccessibleRole's 0N/A * if the set of predefined roles is inadequate. 0N/A * @return an instance of AccessibleRole describing the role of the object 0N/A * @see AccessibleRole 0N/A * Gets the state set of this object. The AccessibleStateSet of an object 0N/A * is composed of a set of unique AccessibleStates. A change in the 0N/A * AccessibleStateSet of an object will cause a PropertyChangeEvent to 0N/A * be fired for the ACCESSIBLE_STATE_PROPERTY property. 0N/A * @return an instance of AccessibleStateSet containing the 0N/A * current state set of the object 0N/A * @see AccessibleStateSet 0N/A * @see AccessibleState 0N/A * @see #addPropertyChangeListener 0N/A // delegate to the AccessibleJOptionPane 0N/A * Gets the Accessible parent of this object. 0N/A * @return the Accessible parent of this object; null if this 0N/A * object does not have an Accessible parent 0N/A * Returns the parent AccessibleContext 0N/A * Gets the 0-based index of this object in its accessible parent. 0N/A * @return the 0-based index of this object in its parent; -1 if this 0N/A * object does not have an accessible parent. 0N/A * @see #getAccessibleParent 0N/A * @see #getAccessibleChildrenCount 0N/A * @see #getAccessibleChild 0N/A // delegate to the AccessibleJOptionPane 0N/A * Returns the number of accessible children of the object. 0N/A * @return the number of accessible children of the object. 0N/A // return the number of children in the JPanel containing 0N/A // the message, note label and progress bar 0N/A * Returns the specified Accessible child of the object. The Accessible 0N/A * children of an Accessible object are zero-based, so the first child 0N/A * of an Accessible child is at index 0, the second child is at index 1, 0N/A * @param i zero-based index of child 0N/A * @return the Accessible child of the object 0N/A * @see #getAccessibleChildrenCount 0N/A // return a child in the JPanel containing the message, note label 0N/A * Returns the AccessibleContext for the JPanel containing the 0N/A * message, note label and progress bar 0N/A * Gets the locale of the component. If the component does not have a 0N/A * locale, then the locale of its parent is returned. 0N/A * @return this component's locale. If this component does not have 0N/A * a locale, the locale of its parent is returned. 0N/A * @exception IllegalComponentStateException 0N/A * If the Component does not have its own locale and has not yet been 0N/A * added to a containment hierarchy such that the locale can be 0N/A * determined from the containing parent. 0N/A // delegate to the AccessibleJOptionPane 0N/A /* ===== end AccessibleContext ===== */ 0N/A * Gets the AccessibleComponent associated with this object that has a 0N/A * graphical representation. 0N/A * @return AccessibleComponent if supported by object; else return null 0N/A * @see AccessibleComponent 0N/A // delegate to the AccessibleJOptionPane 0N/A * Gets the AccessibleValue associated with this object that supports a 0N/A * @return AccessibleValue if supported by object; else return null 0N/A * @see AccessibleValue 0N/A // delegate to the AccessibleJProgressBar 0N/A * Gets the AccessibleText associated with this object presenting 0N/A * text on the display. 0N/A * @return AccessibleText if supported by object; else return null 0N/A * @see AccessibleText 0N/A * Returns the note label AccessibleText 0N/A // AccessibleJLabel implements AccessibleText if the 0N/A // JLabel contains HTML text 0N/A /* ===== Begin AccessibleText impl ===== */ 0N/A * Given a point in local coordinates, return the zero-based index 0N/A * of the character under that Point. If the point is invalid, 0N/A * this method returns -1. 0N/A * @param p the Point in local coordinates 0N/A * @return the zero-based index of the character under Point p; if 0N/A * Point is invalid return -1. 0N/A // convert point from the option pane bounds 0N/A // to the note label bounds. 0N/A * Determines the bounding box of the character at the given 0N/A * index into the string. The bounds are returned in local 0N/A * coordinates. If the index is invalid an empty rectangle is returned. 0N/A * @param i the index into the String 0N/A * @return the screen coordinates of the character's bounding box, 0N/A * if index is invalid return an empty rectangle. 0N/A // return rectangle in the option pane bounds 0N/A * Returns whether source and destination components have the 0N/A * same window ancestor 0N/A * Returns the number of characters (valid indicies) 0N/A * @return the number of characters 0N/A if (
at !=
null) {
// JLabel contains HTML text 0N/A * Returns the zero-based offset of the caret. 0N/A * Note: That to the right of the caret will have the same index 0N/A * value as the offset (the caret is between two characters). 0N/A * @return the zero-based offset of the caret. 0N/A if (
at !=
null) {
// JLabel contains HTML text 0N/A * Returns the String at a given index. 0N/A * @param part the CHARACTER, WORD, or SENTENCE to retrieve 0N/A * @param index an index within the text 0N/A * @return the letter, word, or sentence 0N/A if (
at !=
null) {
// JLabel contains HTML text 0N/A * Returns the String after a given index. 0N/A * @param part the CHARACTER, WORD, or SENTENCE to retrieve 0N/A * @param index an index within the text 0N/A * @return the letter, word, or sentence 0N/A if (
at !=
null) {
// JLabel contains HTML text 0N/A * Returns the String before a given index. 0N/A * @param part the CHARACTER, WORD, or SENTENCE to retrieve 0N/A * @param index an index within the text 0N/A * @return the letter, word, or sentence 0N/A if (
at !=
null) {
// JLabel contains HTML text 0N/A * Returns the AttributeSet for a given character at a given index 0N/A * @param i the zero-based index into the text 0N/A * @return the AttributeSet of the character 0N/A if (
at !=
null) {
// JLabel contains HTML text 0N/A * Returns the start offset within the selected text. 0N/A * If there is no selection, but there is 0N/A * a caret, the start and end offsets will be the same. 0N/A * @return the index into the text of the start of the selection 0N/A if (
at !=
null) {
// JLabel contains HTML text 0N/A * Returns the end offset within the selected text. 0N/A * If there is no selection, but there is 0N/A * a caret, the start and end offsets will be the same. 0N/A * @return the index into teh text of the end of the selection 0N/A if (
at !=
null) {
// JLabel contains HTML text 0N/A * Returns the portion of the text that is selected. 0N/A * @return the String portion of the text that is selected 0N/A if (
at !=
null) {
// JLabel contains HTML text 0N/A /* ===== End AccessibleText impl ===== */ 0N/A // inner class AccessibleProgressMonitor