⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jprogressbar.java

📁 linux下编程用 编译软件
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
   *   * @return Whether the string is painted.   */  public boolean isStringPainted()  {    return paintString;  }  /**   * This method changes the stringPainted property.   *   * @param painted Whether the string is painted.   */  public void setStringPainted(boolean painted)  {    if (paintString != painted)      {	boolean oldPainted = paintString;	paintString = painted;	firePropertyChange("stringPainted", oldPainted,	                   paintString);      }  }  /**   * This method returns the string that is painted if the    * stringPainted property is set to true. If there is no   * string set, it will return a string containing the    * JProgressBar's value as a percent.   *   * @return The string that is painted.   */  public String getString()  {    if (progressString != null)      return progressString;    else      return (int) (getPercentComplete() * 100) + "%";  }  /**   * This method changes the string property. The string   * given will be the one painted. If you want to    * revert to the default string given, set the   * string to null.   *   * @param string The string to be painted.   */  public void setString(String string)  {    if (((string == null || progressString == null) &&        string != progressString) || (string != null &&	! string.equals(progressString)))      {	String oldString = progressString;	progressString = string;	firePropertyChange("string", oldString, progressString);      }  }  /**   * This method returns the percent of the bar   * that is "complete". (This is the amount value / (max - min)).   *   * @return DOCUMENT ME!   */  public double getPercentComplete()  {    if (getMaximum() == getMinimum())      return 1.0;    else      return (double) (model.getValue() - model.getMinimum()) / (model                                                                 .getMaximum()             - model.getMinimum());  }  /**   * This method returns whether the border is painted.   *   * @return Whether the border is painted.   */  public boolean isBorderPainted()  {    return paintBorder;  }  /**   * This method changes the borderPainted property.   *   * @param painted Whether the border is painted.   */  public void setBorderPainted(boolean painted)  {    if (painted != paintBorder)      {	boolean oldPainted = paintBorder;	paintBorder = painted;	firePropertyChange("borderPainted", oldPainted,	                   paintBorder);      }  }  /**   * This method returns the JProgressBar's UI delegate.   *   * @return This JProgressBar's UI delegate.   */  public ProgressBarUI getUI()  {    return (ProgressBarUI) ui;  }  /**   * This method changes the UI property for this JProgressBar.   *   * @param ui The new UI delegate.   */  public void setUI(ProgressBarUI ui)  {    super.setUI(ui);  }  /**   * This method reverts the UI delegate for this JProgressBar   * to the default for this Look and Feel.   */  public void updateUI()  {    setUI((ProgressBarUI) UIManager.getUI(this));    invalidate();  }  /**   * This method returns the identifier to allow the UIManager   * to pick the correct class to act as the UI for   * this JProgressBar.   *   * @return The UIClassID: "ProgressBarUI".   */  public String getUIClassID()  {    return "ProgressBarUI";  }  /**   * This method returns a ChangeListener that gets registered   * model. By default, the ChangeListener, propagates the    * ChangeEvents to the ChangeListeners of the JProgressBar.   *   * @return A new ChangeListener.   */  protected ChangeListener createChangeListener()  {    return new ChangeListener()      {	public void stateChanged(ChangeEvent ce)	{	  fireStateChanged();	}      };  }  /**   * This method adds a ChangeListener to this JProgressBar.   *   * @param listener The ChangeListener to add to this JProgressBar.   */  public void addChangeListener(ChangeListener listener)  {    listenerList.add(ChangeListener.class, listener);  }  /**   * This method removes a ChangeListener from this JProgressBar.   *   * @param listener The ChangeListener to remove from this JProgressBar.   */  public void removeChangeListener(ChangeListener listener)  {    listenerList.remove(ChangeListener.class, listener);  }    /**   * This method returns an array of all ChangeListeners listening to this   * progress bar.   *   * @return An array of ChangeListeners listening to this progress bar.   */  public ChangeListener[] getChangeListeners()  {    return (ChangeListener[]) listenerList.getListeners(ChangeListener.class);  }    /**   * This method is called when the JProgressBar receives a ChangeEvent   * from its model. This simply propagates the event (changing the source   * to the JProgressBar) to the JProgressBar's listeners.   */  protected void fireStateChanged()  {    Object[] changeListeners = listenerList.getListenerList();    if (changeEvent == null)      changeEvent = new ChangeEvent(this);    for (int i = changeListeners.length - 2; i >= 0; i -= 2)      {	if (changeListeners[i] == ChangeListener.class)	  ((ChangeListener) changeListeners[i + 1]).stateChanged(changeEvent);      }  }  /**   * This method returns the model used with this JProgressBar.   *   * @return The model used with this JProgressBar.   */  public BoundedRangeModel getModel()  {    return model;  }  /**   * This method changes the model property for this JProgressBar.   *   * @param model The model to use with this JProgressBar.   */  public void setModel(BoundedRangeModel model)  {    if (model != this.model)      {        this.model.removeChangeListener(changeListener);	this.model = model;	this.model.addChangeListener(changeListener);	fireStateChanged();      }  }  /**   * This method returns the minimum value of this JProgressBar.   *   * @return The minimum value of this JProgressBar.   */  public int getMinimum()  {    return model.getMinimum();  }  /**   * This method sets the minimum value of this JProgressBar.   *   * @param minimum The minimum value of this JProgressBar.   */  public void setMinimum(int minimum)  {    model.setMinimum(minimum);  }  /**   * This method returns the maximum value of this JProgressBar.   *   * @return The maximum value of this JProgressBar.   */  public int getMaximum()  {    return model.getMaximum();  }  /**   * This method sets the maximum value of this JProgressBar.   *   * @param maximum The maximum value of this JProgressBar.   */  public void setMaximum(int maximum)  {    model.setMaximum(maximum);  }  /**   * This method returns a string that can be used to    * describe this JProgressBar. This method is usually   * only used for debugging purposes.   *   * @return A string that describes this JProgressBar.   */  protected String paramString()  {    return "JProgressBar";  }  /**   * This method changes the indeterminate property. If the   * JProgressBar is determinate, it paints a percentage   * of the bar described by its value. If it is indeterminate,   * it simply bounces a box between the ends of the bar; the    * value of the JProgressBar is ignored.   *   * @param newValue Whether the JProgressBar is indeterminate.   */  public void setIndeterminate(boolean newValue)  {    if (indeterminate != newValue)      {	boolean olddeter = indeterminate;	indeterminate = newValue;	firePropertyChange("indeterminate", olddeter,	                   indeterminate);      }  }  /**   * This method returns whether the JProgressBar is indeterminate.   *   * @return Whether this JProgressBar is indeterminate.   */  public boolean isIndeterminate()  {    return indeterminate;  }  /**   * DOCUMENT ME!   *   * @return DOCUMENT ME!   */  public AccessibleContext getAccessibleContext()  {    if (accessibleContext == null)      accessibleContext = new AccessibleJProgressBar();        return accessibleContext;  } }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -