Java Doc for BasicProgressBarUI.java in  » 6.0-JDK-Core » swing » javax » swing » plaf » basic » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » swing » javax.swing.plaf.basic 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.swing.plaf.ComponentUI
      javax.swing.plaf.ProgressBarUI
         javax.swing.plaf.basic.BasicProgressBarUI

All known Subclasses:   javax.swing.plaf.metal.MetalProgressBarUI,  javax.swing.plaf.synth.SynthProgressBarUI,
BasicProgressBarUI
public class BasicProgressBarUI extends ProgressBarUI (Code)
A Basic L&F implementation of ProgressBarUI.
version:
   1.80 05/05/07
author:
   Michael C. Albers
author:
   Kathy Walrath

Inner Class :public class ChangeHandler implements ChangeListener

Field Summary
protected  RectangleboxRect
     Used to hold the location and size of the bouncing box (returned by getBox) to be painted.
protected  ChangeListenerchangeListener
    
protected  JProgressBarprogressBar
    


Method Summary
public static  ComponentUIcreateUI(JComponent x)
    
protected  intgetAmountFull(Insets b, int width, int height)
     This determines the amount of the progress bar that should be filled based on the percent done gathered from the model.
protected  intgetAnimationIndex()
     Gets the index of the current animation frame.
public  intgetBaseline(JComponent c, int width, int height)
     Returns the baseline.
public  Component.BaselineResizeBehaviorgetBaselineResizeBehavior(JComponent c)
     Returns an enum indicating how the baseline of the component changes as the size changes.
protected  RectanglegetBox(Rectangle r)
     Stores the position and size of the bouncing box that would be painted for the current animation index in r and returns r.
protected  intgetBoxLength(int availableLength, int otherDimension)
     Returns the length of the "bouncing box" to be painted.
protected  intgetCellLength()
     Returns the width (if HORIZONTAL) or height (if VERTICAL) of each of the indivdual cells/units to be rendered in the progress bar.
protected  intgetCellSpacing()
     Returns the spacing between each of the cells/units in the progress bar.
final protected  intgetFrameCount()
     Returns the number of frames for the complete animation loop used by an indeterminate JProgessBar.
public  DimensiongetMaximumSize(JComponent c)
    
public  DimensiongetMinimumSize(JComponent c)
     The Minimum size for this component is 10.
protected  DimensiongetPreferredInnerHorizontal()
    
protected  DimensiongetPreferredInnerVertical()
    
public  DimensiongetPreferredSize(JComponent c)
    
protected  ColorgetSelectionBackground()
     The "selectionBackground" is the color of the text when it is painted over an unfilled area of the progress bar.
protected  ColorgetSelectionForeground()
     The "selectionForeground" is the color of the text when it is painted over a filled area of the progress bar.
protected  PointgetStringPlacement(Graphics g, String progressString, int x, int y, int width, int height)
     Designate the place where the progress string will be painted. This implementation places it at the center of the progress bar (in both x and y).
protected  voidincrementAnimationIndex()
     Sets the index of the current animation frame, to the next valid value, which results in the progress bar being repainted.
protected  voidinstallDefaults()
    
protected  voidinstallListeners()
    
public  voidinstallUI(JComponent c)
    
public  voidpaint(Graphics g, JComponent c)
     Delegates painting to one of two methods: paintDeterminate or paintIndeterminate.
protected  voidpaintDeterminate(Graphics g, JComponent c)
     All purpose paint method that should do the right thing for almost all linear, determinate progress bars.
protected  voidpaintIndeterminate(Graphics g, JComponent c)
     All purpose paint method that should do the right thing for all linear bouncing-box progress bars.
protected  voidpaintString(Graphics g, int x, int y, int width, int height, int amountFull, Insets b)
    
protected  voidsetAnimationIndex(int newValue)
     Sets the index of the current animation frame to the specified value and requests that the progress bar be repainted.
protected  voidsetCellLength(int cellLen)
    
protected  voidsetCellSpacing(int cellSpace)
    
protected  voidstartAnimationTimer()
     Starts the animation thread, creating and initializing it if necessary.
protected  voidstopAnimationTimer()
     Stops the animation thread. This method is invoked when the indeterminate animation should be stopped.
protected  voiduninstallDefaults()
    
protected  voiduninstallListeners()
     Removes all listeners installed by this object.
public  voiduninstallUI(JComponent c)
    

Field Detail
boxRect
protected Rectangle boxRect(Code)
Used to hold the location and size of the bouncing box (returned by getBox) to be painted.
since:
   1.5



changeListener
protected ChangeListener changeListener(Code)



progressBar
protected JProgressBar progressBar(Code)





Method Detail
createUI
public static ComponentUI createUI(JComponent x)(Code)



getAmountFull
protected int getAmountFull(Insets b, int width, int height)(Code)
This determines the amount of the progress bar that should be filled based on the percent done gathered from the model. This is a common operation so it was abstracted out. It assumes that your progress bar is linear. That is, if you are making a circular progress indicator, you will want to override this method.



getAnimationIndex
protected int getAnimationIndex()(Code)
Gets the index of the current animation frame.
since:
   1.4



getBaseline
public int getBaseline(JComponent c, int width, int height)(Code)
Returns the baseline.
throws:
  NullPointerException -
throws:
  IllegalArgumentException -
See Also:   javax.swing.JComponent.getBaseline(intint)
since:
   1.6



getBaselineResizeBehavior
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)(Code)
Returns an enum indicating how the baseline of the component changes as the size changes.
throws:
  NullPointerException -
See Also:   javax.swing.JComponent.getBaseline(intint)
since:
   1.6



getBox
protected Rectangle getBox(Rectangle r)(Code)
Stores the position and size of the bouncing box that would be painted for the current animation index in r and returns r. Subclasses that add to the painting performed in this class's implementation of paintIndeterminate -- to draw an outline around the bouncing box, for example -- can use this method to get the location of the bouncing box that was just painted. By overriding this method, you have complete control over the size and position of the bouncing box, without having to reimplement paintIndeterminate.
Parameters:
  r - the Rectangle instance to be modified;may be null null if no box should be drawn;otherwise, returns the passed-in rectangle(if non-null)or a new rectangle
See Also:   BasicProgressBarUI.setAnimationIndex
since:
   1.4



getBoxLength
protected int getBoxLength(int availableLength, int otherDimension)(Code)
Returns the length of the "bouncing box" to be painted. This method is invoked by the default implementation of paintIndeterminate to get the width (if the progress bar is horizontal) or height (if vertical) of the box. For example:
 boxRect.width = getBoxLength(componentInnards.width,
 componentInnards.height);
 

Parameters:
  availableLength - the amount of space availablefor the bouncing box to move in;for a horizontal progress bar,for example,this should bethe inside width of the progress bar(the component width minus borders)
Parameters:
  otherDimension - for a horizontal progress bar, this should bethe inside height of the progress bar; thisvalue might be used to constrain or determinethe return value the size of the box dimension being determined; must be no larger than availableLength
See Also:   javax.swing.SwingUtilities.calculateInnerArea
since:
   1.5



getCellLength
protected int getCellLength()(Code)
Returns the width (if HORIZONTAL) or height (if VERTICAL) of each of the indivdual cells/units to be rendered in the progress bar. However, for text rendering simplification and aesthetic considerations, this function will return 1 when the progress string is being rendered. the value representing the spacing between cells
See Also:   BasicProgressBarUI.setCellLength
See Also:   JProgressBar.isStringPainted



getCellSpacing
protected int getCellSpacing()(Code)
Returns the spacing between each of the cells/units in the progress bar. However, for text rendering simplification and aesthetic considerations, this function will return 0 when the progress string is being rendered. the value representing the spacing between cells
See Also:   BasicProgressBarUI.setCellSpacing
See Also:   JProgressBar.isStringPainted



getFrameCount
final protected int getFrameCount()(Code)
Returns the number of frames for the complete animation loop used by an indeterminate JProgessBar. The progress chunk will go from one end to the other and back during the entire loop. This visual behavior may be changed by subclasses in other Look and Feels. the number of frames
since:
   1.6



getMaximumSize
public Dimension getMaximumSize(JComponent c)(Code)



getMinimumSize
public Dimension getMinimumSize(JComponent c)(Code)
The Minimum size for this component is 10. The rationale here is that there should be at least one pixel per 10 percent.



getPreferredInnerHorizontal
protected Dimension getPreferredInnerHorizontal()(Code)



getPreferredInnerVertical
protected Dimension getPreferredInnerVertical()(Code)



getPreferredSize
public Dimension getPreferredSize(JComponent c)(Code)



getSelectionBackground
protected Color getSelectionBackground()(Code)
The "selectionBackground" is the color of the text when it is painted over an unfilled area of the progress bar.



getSelectionForeground
protected Color getSelectionForeground()(Code)
The "selectionForeground" is the color of the text when it is painted over a filled area of the progress bar.



getStringPlacement
protected Point getStringPlacement(Graphics g, String progressString, int x, int y, int width, int height)(Code)
Designate the place where the progress string will be painted. This implementation places it at the center of the progress bar (in both x and y). Override this if you want to right, left, top, or bottom align the progress string or if you need to nudge it around for any reason.



incrementAnimationIndex
protected void incrementAnimationIndex()(Code)
Sets the index of the current animation frame, to the next valid value, which results in the progress bar being repainted. The next valid value is, by default, the current animation index plus one. If the new value would be too large, this method sets the index to 0. Subclasses might need to override this method to ensure that the index does not go over the number of frames needed for the particular progress bar instance. This method is invoked by the default animation thread every X milliseconds, where X is specified by the "ProgressBar.repaintInterval" UI default.
See Also:   BasicProgressBarUI.setAnimationIndex
since:
   1.4



installDefaults
protected void installDefaults()(Code)



installListeners
protected void installListeners()(Code)



installUI
public void installUI(JComponent c)(Code)



paint
public void paint(Graphics g, JComponent c)(Code)
Delegates painting to one of two methods: paintDeterminate or paintIndeterminate.



paintDeterminate
protected void paintDeterminate(Graphics g, JComponent c)(Code)
All purpose paint method that should do the right thing for almost all linear, determinate progress bars. By setting a few values in the defaults table, things should work just fine to paint your progress bar. Naturally, override this if you are making a circular or semi-circular progress bar.
See Also:   BasicProgressBarUI.paintIndeterminate
since:
   1.4



paintIndeterminate
protected void paintIndeterminate(Graphics g, JComponent c)(Code)
All purpose paint method that should do the right thing for all linear bouncing-box progress bars. Override this if you are making another kind of progress bar.
See Also:   BasicProgressBarUI.paintDeterminate
since:
   1.4



paintString
protected void paintString(Graphics g, int x, int y, int width, int height, int amountFull, Insets b)(Code)



setAnimationIndex
protected void setAnimationIndex(int newValue)(Code)
Sets the index of the current animation frame to the specified value and requests that the progress bar be repainted. Subclasses that don't use the default painting code might need to override this method to change the way that the repaint method is invoked.
Parameters:
  newValue - the new animation index; no checkingis performed on its value
See Also:   BasicProgressBarUI.incrementAnimationIndex
since:
   1.4



setCellLength
protected void setCellLength(int cellLen)(Code)



setCellSpacing
protected void setCellSpacing(int cellSpace)(Code)



startAnimationTimer
protected void startAnimationTimer()(Code)
Starts the animation thread, creating and initializing it if necessary. This method is invoked when an indeterminate progress bar should start animating. Reasons for this may include:
  • The progress bar is determinate and becomes displayable
  • The progress bar is displayable and becomes determinate
  • The progress bar is displayable and determinate and this UI is installed
If you implement your own animation thread, you must override this method.
since:
   1.4
See Also:   BasicProgressBarUI.stopAnimationTimer



stopAnimationTimer
protected void stopAnimationTimer()(Code)
Stops the animation thread. This method is invoked when the indeterminate animation should be stopped. Reasons for this may include:
  • The progress bar changes to determinate
  • The progress bar is no longer part of a displayable hierarchy
  • This UI in uninstalled
If you implement your own animation thread, you must override this method.
since:
   1.4
See Also:   BasicProgressBarUI.startAnimationTimer



uninstallDefaults
protected void uninstallDefaults()(Code)



uninstallListeners
protected void uninstallListeners()(Code)
Removes all listeners installed by this object.



uninstallUI
public void uninstallUI(JComponent c)(Code)




Methods inherited from javax.swing.plaf.ComponentUI
public boolean contains(JComponent c, int x, int y)(Code)(Java Doc)
public static ComponentUI createUI(JComponent c)(Code)(Java Doc)
public Accessible getAccessibleChild(JComponent c, int i)(Code)(Java Doc)
public int getAccessibleChildrenCount(JComponent c)(Code)(Java Doc)
public int getBaseline(JComponent c, int width, int height)(Code)(Java Doc)
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)(Code)(Java Doc)
public Dimension getMaximumSize(JComponent c)(Code)(Java Doc)
public Dimension getMinimumSize(JComponent c)(Code)(Java Doc)
public Dimension getPreferredSize(JComponent c)(Code)(Java Doc)
public void installUI(JComponent c)(Code)(Java Doc)
public void paint(Graphics g, JComponent c)(Code)(Java Doc)
public void uninstallUI(JComponent c)(Code)(Java Doc)
public void update(Graphics g, JComponent c)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.