javax.swing.plaf.basic
Class BasicProgressBarUI
The Basic Look and Feel UI delegate for the
JProgressBar.
static ComponentUI | createUI(JComponent x) - Creates a new BasicProgressBarUI for the component.
|
protected int | getAmountFull(Insets b, int width, int height) - This method returns the length of the bar (from the minimum)
in pixels (or units that the Graphics object draws in) based
on the progressBar's getPercentComplete() value.
|
protected int | getAnimationIndex() - The current animation index.
|
protected Rectangle | getBox(Rectangle r) - This method returns the size and position of the bouncing box
for the current animation index.
|
protected int | getCellLength() - This method returns the length of the cells.
|
protected int | getCellSpacing() - This method returns the spacing between cells.
|
Dimension | getMaximumSize(JComponent c) - This method returns the maximum size of the JComponent.
|
Dimension | getMinimumSize(JComponent c) - This method returns the minimum size of the JComponent.
|
protected Dimension | getPreferredInnerHorizontal() - This method returns the preferred size of the inner
rectangle (the bounds without the insets) if the
progressBar is horizontal.
|
protected Dimension | getPreferredInnerVertical() - This method returns the preferred size of the inner
rectangle (the bounds without insets) if the
progressBar is vertical.
|
Dimension | getPreferredSize(JComponent c) - This method returns the preferred size of the
given JComponent.
|
protected Color | getSelectionBackground() - This method returns the Color that the text is shown in when the bar is
not over the text.
|
protected Color | getSelectionForeground() - This method returns the Color that the text is shown in when the bar is
over the text.
|
protected Point | getStringPlacement(Graphics g, String progressString, int x, int y, int width, int height) - This method returns the point (the top left of the bounding box)
where the text should be painted.
|
protected void | incrementAnimationIndex() - This method increments the animation index.
|
protected void | installDefaults() - This method changes the settings for the progressBar to
the defaults provided by the current Look and Feel.
|
protected void | installListeners() - This method registers listeners to all the
components that this UI delegate needs to listen to.
|
void | installUI(JComponent c) - This method installs the UI for the given JComponent.
|
void | paint(Graphics g, JComponent c) - This method paints the progressBar.
|
protected void | paintDeterminate(Graphics g, JComponent c) - This method is called if the painting to be done is
for a determinate progressBar.
|
protected void | paintIndeterminate(Graphics g, JComponent c) - This method is called if the painting to be done is for
an indeterminate progressBar.
|
protected void | paintString(Graphics g, int x, int y, int width, int height, int amountFull, Insets b) - This method paints the string for the progressBar.
|
protected void | setAnimationIndex(int newValue) - This method sets the current animation index.
|
protected void | setCellLength(int cellLen) - This method sets the cell length.
|
protected void | setCellSpacing(int cellSpace) - This method sets the cell spacing.
|
protected void | startAnimationTimer() - This method starts the animation timer.
|
protected void | stopAnimationTimer() - This method stops the animation timer.
|
protected void | uninstallDefaults() - The method uninstalls any defaults that were
set by the current Look and Feel.
|
protected void | uninstallListeners() - This method unregisters listeners to all the
components that were listened to.
|
void | uninstallUI(JComponent c) - This method removes the UI for the given JComponent.
|
contains , createUI , getAccessibleChild , getAccessibleChildrenCount , getMaximumSize , getMinimumSize , getPreferredSize , installUI , paint , uninstallUI , update |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
getAmountFull
protected int getAmountFull(Insets b,
int width,
int height)
This method returns the length of the bar (from the minimum)
in pixels (or units that the Graphics object draws in) based
on the progressBar's getPercentComplete() value.
b
- The insets of the progressBar.width
- The width of the progressBar.height
- The height of the progressBar.
- The length of the bar that should be painted in pixels.
getAnimationIndex
protected int getAnimationIndex()
The current animation index.
- The current animation index.
getBox
protected Rectangle getBox(Rectangle r)
This method returns the size and position of the bouncing box
for the current animation index. It stores the values in the
given rectangle and returns it. It returns null if no box should
be drawn.
r
- The bouncing box rectangle.
- The bouncing box rectangle.
getCellLength
protected int getCellLength()
This method returns the length of the cells.
getCellSpacing
protected int getCellSpacing()
This method returns the spacing between cells.
getPreferredInnerHorizontal
protected Dimension getPreferredInnerHorizontal()
This method returns the preferred size of the inner
rectangle (the bounds without the insets) if the
progressBar is horizontal.
- The preferred size of the progressBar minus
insets if it's horizontal.
getPreferredInnerVertical
protected Dimension getPreferredInnerVertical()
This method returns the preferred size of the inner
rectangle (the bounds without insets) if the
progressBar is vertical.
- The preferred size of the progressBar minus
insets if it's vertical.
getPreferredSize
public Dimension getPreferredSize(JComponent c)
This method returns the preferred size of the
given JComponent. If it returns null, then it
is up to the LayoutManager to give it a size.
- getPreferredSize in interface ComponentUI
c
- The component to find the preferred size for.
- The preferred size of the component.
getSelectionBackground
protected Color getSelectionBackground()
This method returns the Color that the text is shown in when the bar is
not over the text.
- The color of the text when the bar is not over it.
getSelectionForeground
protected Color getSelectionForeground()
This method returns the Color that the text is shown in when the bar is
over the text.
- The color of the text when the bar is over it.
getStringPlacement
protected Point getStringPlacement(Graphics g,
String progressString,
int x,
int y,
int width,
int height)
This method returns the point (the top left of the bounding box)
where the text should be painted.
g
- The Graphics object to measure FontMetrics with.progressString
- The string to paint.x
- The x coordinate of the overall bounds box.y
- The y coordinate of the overall bounds box.width
- The width of the overall bounds box.height
- The height of the overall bounds box.
- The top left of the bounding box where text should be painted.
installDefaults
protected void installDefaults()
This method changes the settings for the progressBar to
the defaults provided by the current Look and Feel.
installListeners
protected void installListeners()
This method registers listeners to all the
components that this UI delegate needs to listen to.
installUI
public void installUI(JComponent c)
This method installs the UI for the given JComponent.
This includes setting up defaults and listeners as
well as initializing any values or objects that
the UI may need.
- installUI in interface ComponentUI
c
- The JComponent that is having this UI installed.
paint
public void paint(Graphics g,
JComponent c)
This method paints the progressBar. It delegates its responsibilities
to paintDeterminate and paintIndeterminate.
- paint in interface ComponentUI
g
- The Graphics object to paint with.c
- The JComponent to paint.
paintDeterminate
protected void paintDeterminate(Graphics g,
JComponent c)
This method is called if the painting to be done is
for a determinate progressBar.
g
- The Graphics object to paint with.c
- The JComponent to paint.
paintIndeterminate
protected void paintIndeterminate(Graphics g,
JComponent c)
This method is called if the painting to be done is for
an indeterminate progressBar.
g
- The Graphics object to paint with.c
- The JComponent to paint.
paintString
protected void paintString(Graphics g,
int x,
int y,
int width,
int height,
int amountFull,
Insets b)
This method paints the string for the progressBar.
g
- The Graphics object to paint with.x
- The x coordinate of the progressBar.y
- The y coordinate of the progressBar.width
- The width of the progressBar.height
- The height of the progressBar.amountFull
- The amount of the progressBar that has its bar filled.b
- The insets of the progressBar.
setAnimationIndex
protected void setAnimationIndex(int newValue)
This method sets the current animation index. If the index is greater than
the number of frames, it resets to 0.
newValue
- The new animation index.
setCellLength
protected void setCellLength(int cellLen)
This method sets the cell length.
cellLen
- The cell length.
setCellSpacing
protected void setCellSpacing(int cellSpace)
This method sets the cell spacing.
cellSpace
- The cell spacing.
startAnimationTimer
protected void startAnimationTimer()
This method starts the animation timer. It is called
when the propertyChangeListener detects that the progressBar
has changed to indeterminate mode.
stopAnimationTimer
protected void stopAnimationTimer()
This method stops the animation timer. It is called when
the propertyChangeListener detects that the progressBar
has changed to determinate mode.
uninstallDefaults
protected void uninstallDefaults()
The method uninstalls any defaults that were
set by the current Look and Feel.
uninstallListeners
protected void uninstallListeners()
This method unregisters listeners to all the
components that were listened to.
uninstallUI
public void uninstallUI(JComponent c)
This method removes the UI for the given JComponent.
This includes removing any listeners or defaults
that the installUI may have set up.
- uninstallUI in interface ComponentUI
c
- The JComponent that is having this UI uninstalled.
BasicProgressBarUI.java --
Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.