canUseWindowBlitter()
Returns true if the viewport is not obscured by one of its ancestors,
or its ancestors children and if the viewport is showing.

protected boolean

computeBlit(int dx,
int dy,
Point blitFrom,
Point blitTo,
Dimension blitSize,
Rectangle blitPaint)
Computes the parameters for a blit where the backing store image
currently contains oldLoc in the upper left hand corner
and we're scrolling to newLoc.

isOptimizedDrawingEnabled()Enabled: The JViewport overrides the default implementation of
this method (in JComponent) to return false.

private boolean

needsRepaintAfterBlit()
Returns true if the component needs to be completely repainted after
a blit and a paint is received.

void

paint(Graphics g)Suppressed: Depending on whether the backingStore is enabled,
either paint the image through the backing store or paint
just the recently exposed part, using the backing store
to "blit" the remainder.

setBorder(javax.swing.border.Border border)Enabled: The viewport "scrolls" its child (called the "view") by the
normal parent/child clipping (typically the view is moved in
the opposite direction of the scroll).

void

setExtentSize(Dimension newExtent)Enabled: Sets the size of the visible part of the view using view coordinates.

void

setScrollMode(int mode)Enabled: Used to control the method of scrolling the viewport contents.

void

setUI(javax.swing.plaf.ViewportUI ui)Suppressed: Sets the L&F object that renders this component.

void

setView(Component view)Enabled: Sets the JViewport's one lightweight child
(view), which can be null.

void

setViewPosition(Point p)Enabled: Sets the view coordinates that appear in the upper left
hand corner of the viewport, does nothing if there's no view.

isViewSizeSet

lastPaintPosition

The last viewPosition that we've painted, so we know how
much of the backing store image is valid.

backingStore

protected boolean backingStore

Deprecated.As of Java 2 platform v1.3

True when this viewport is maintaining an offscreen image of its
contents, so that some scrolling can take place using fast "bit-blit"
operations instead of by accessing the view object to construct the
display. The default is false.

backingStoreImage

scrollUnderway

protected boolean scrollUnderway

The scrollUnderway flag is used for components like
JList. When the downarrow key is pressed on a
JList and the selected
cell is the last in the list, the scrollpane autoscrolls.
Here, the old selected cell needs repainting and so we need
a flag to make the viewport do the optimized painting
only when there is an explicit call to
setViewPosition(Point).
When setBounds is called through other routes,
the flag is off and the view repaints normally. Another approach
would be to remove this from the JViewport
class and have the JList manage this case by using
setBackingStoreEnabled. The default is
false.

BLIT_SCROLL_MODE

BACKINGSTORE_SCROLL_MODE

public static final int BACKINGSTORE_SCROLL_MODE

Enabled: Draws viewport contents into an offscreen image.
This was previously the default mode for JTable.
This mode may offer advantages over "blit mode"
in some cases, but it requires a large chunk of extra RAM.

SIMPLE_SCROLL_MODE

public static final int SIMPLE_SCROLL_MODE

Enabled: This mode uses the very simple method of redrawing the entire
contents of the scrollpane each time it is scrolled.
This was the default behavior in Swing 1.0 and Swing 1.1.
Either of the other two options will provide better performance
in most cases.

scrollMode

repaintAll

private transient boolean repaintAll

This is set to true in setViewPosition
if doing a window blit and the viewport is obscured.

waitingForRepaint

private transient boolean waitingForRepaint

This is set to true in paint, if repaintAll
is true and the clip rectangle does not match the bounds.
If true, and scrolling happens the
repaint manager is not cleared which then allows for the repaint
previously invoked to succeed.

scrollRectToVisible

Enabled: Scrolls the view so that Rectangle
within the view becomes visible.

This attempts to validate the view before scrolling if the
view is currently not valid - isValid returns false.
To avoid excessive validation when the containment hierarchy is
being created this will not validate if one of the ancestors does not
have a peer, or there is no validate root ancestor, or one of the
ancestors is not a Window or Applet.

Note that this method will not scroll outside of the
valid viewport; for example, if contentRect is larger
than the viewport, scrolling will be confined to the viewport's
bounds.

validateView

private void validateView()

Ascends the Viewport's parents stopping when
a component is found that returns
true to isValidateRoot.
If all the Component's parents are visible,
validate will then be invoked on it. The
RepaintManager is then invoked with
removeInvalidComponent. This
is the synchronous version of a revalidate.

positionAdjustment

setBorder

public final void setBorder(javax.swing.border.Border border)

Enabled: The viewport "scrolls" its child (called the "view") by the
normal parent/child clipping (typically the view is moved in
the opposite direction of the scroll). A non-null border,
or non-zero insets, isn't supported, to prevent the geometry
of this component from becoming complex enough to inhibit
subclassing. To create a JViewport with a border,
add it to a JPanel that has a border.

Note: If border is non-null, this
method will throw an exception as borders are not supported on
a JViewPort.

getBackingStoreGraphics

paintViaBackingStore

paintViaBackingStore

isOptimizedDrawingEnabled

public boolean isOptimizedDrawingEnabled()

Enabled: The JViewport overrides the default implementation of
this method (in JComponent) to return false.
This ensures
that the drawing machinery will call the Viewport's
paint
implementation rather than messaging the JViewport's
children directly.

isBackingStoreEnabled

Enabled: Returns true if this viewport is maintaining
an offscreen image of its contents.

Returns:

true if scrollMode is
BACKINGSTORE_SCROLL_MODE

setBackingStoreEnabled

public void setBackingStoreEnabled(boolean enabled)

Deprecated.As of Java 2 platform v1.3, replaced by
setScrollMode().

Enabled: If true if this viewport will maintain an offscreen
image of its contents. The image is used to reduce the cost
of small one dimensional changes to the viewPosition.
Rather than repainting the entire viewport we use
Graphics.copyArea to effect some of the scroll.

computeBlit

Computes the parameters for a blit where the backing store image
currently contains oldLoc in the upper left hand corner
and we're scrolling to newLoc.
The parameters are modified
to return the values required for the blit.

Parameters:

dx - the horizontal delta

dy - the vertical delta

blitFrom - the Point we're blitting from

blitTo - the Point we're blitting to

blitSize - the Dimension of the area to blit

blitPaint - the area to blit

Returns:

true if the parameters are modified and we're ready to blit;
false otherwise

paramString

Returns a string representation of this JViewport.
This method
is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not
be null.

blitWindowGraphics

Blits the parent windows graphics from the given region offset
to ox, oy.

canUseWindowBlitter

private boolean canUseWindowBlitter()

Returns true if the viewport is not obscured by one of its ancestors,
or its ancestors children and if the viewport is showing. Blitting
when the view isn't showing will work,
or rather copyArea will work,
but will not produce the expected behavior.

getAccessibleContext

Suppressed: Gets the AccessibleContext associated with this JViewport.
For viewports, the AccessibleContext takes the form of an
AccessibleJViewport.
A new AccessibleJViewport instance is created if necessary.