All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.JViewport
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----com.sun.java.swing.JComponent
|
+----com.sun.java.swing.JViewport
- public class JViewport
- extends JComponent
- implements Accessible
Lazy drawing in ScrollPanes.
-
backingStore
-
-
backingStoreImage
-
-
changeEvent
-
-
isViewSizeSet
-
-
lastPaintPosition
- The last viewPosition that we've painted, so we know how
much of the backing store image is valid.
-
scrollUnderway
-
-
viewListener
-
-
JViewport()
-
-
add(Component)
- Sets the Viewports one lightweight child, x can be null.
-
addChangeListener(ChangeListener)
- Adds a ChangeListener to the button.
-
computeBlit(int, int, Point, Point, Dimension, Rectangle)
- 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.
-
createLayoutManager()
- Subclassers can override this to install a different
layout manager (or null) in the constructor.
-
createViewListener()
-
-
fireStateChanged()
-
-
getAccessibleRole()
- Get the role of this object.
-
getExtentSize()
- Returns the size of the visible part of the view in view coordinates.
-
getInsets()
- The viewport "scrolls" it's child (called the "view") by the
normal parent/child clipping (typically the view is moved in
the opposite direction of the scroll).
-
getView()
- Returns the Viewports one child or null.
-
getViewPosition()
- Returns the view coordinates that appear in the upper left
hand corner of the viewport, 0,0 if there's no view.
-
getViewRect()
- Return a rectangle whose origin is getViewPosition and size is
getExtentSize().
-
getViewSize()
- If the views size hasn't been explicitly set return the
preferred size, otherwise return the views current size.
-
isBackingStoreEnabled()
- Returns true if this viewport is maintaining an offscreen
image of its contents.
-
paint(Graphics)
- 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.
-
remove(Component)
-
-
removeChangeListener(ChangeListener)
- Removes a ChangeListener from the button.
-
scrollRectToVisible(Rectangle)
- Overridden to scroll the View such that aRect within the
View becomes visible.
-
setBackingStoreEnabled(boolean)
- If true if this viewport will maintain an offscreen
image of its contents.
-
setBounds(int, int, int, int)
-
Moves and resizes this component.
-
setExtentSize(Dimension)
- Set the size of the visible part of the view, newExtent is
in view coordinates.
-
setView(Component)
- Sets the Viewports one lightweight child, x can be null.
-
setViewPosition(Point)
- Sets the view coordinates that appear in the upper left
hand corner of the viewport, null if there's no view.
-
setViewSize(Dimension)
- Sets the view coordinates that appear in the upper left
hand corner of the viewport, null if there's no view.
-
toViewCoordinates(Dimension)
- Convert a size in pixel coordinates to view coordinates.
-
toViewCoordinates(Point)
- Convert a point in pixel coordinates to view coordinates.
isViewSizeSet
protected boolean isViewSizeSet
lastPaintPosition
protected Point lastPaintPosition
- The last viewPosition that we've painted, so we know how
much of the backing store image is valid.
backingStore
protected boolean backingStore
backingStoreImage
protected Image backingStoreImage
scrollUnderway
protected boolean scrollUnderway
viewListener
protected ComponentListener viewListener
changeEvent
protected transient ChangeEvent changeEvent
JViewport
public JViewport()
add
public Component add(Component x)
- Sets the Viewports one lightweight child, x can be null.
- Overrides:
- add in class Container
- See Also:
- setView
remove
public void remove(Component x)
- Overrides:
- remove in class Container
scrollRectToVisible
public void scrollRectToVisible(Rectangle contentRect)
- Overridden to scroll the View such that aRect within the
View becomes visible.
- Overrides:
- scrollRectToVisible in class JComponent
getInsets
public final Insets getInsets()
- The viewport "scrolls" it's child (called the "view") by the
normal parent/child clipping (typically the view is moved in
the opposite direction of the scroll). Non-zero insets aren't
possible without introducing an extra container.
- Overrides:
- getInsets in class JComponent
paint
public void paint(Graphics g)
- 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.
- Overrides:
- paint in class JComponent
setBounds
public void setBounds(int x,
int y,
int w,
int h)
- Moves and resizes this component.
- Overrides:
- setBounds in class JComponent
isBackingStoreEnabled
public boolean isBackingStoreEnabled()
- Returns true if this viewport is maintaining an offscreen
image of its contents.
setBackingStoreEnabled
public void setBackingStoreEnabled(boolean x)
- 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.
getView
public Component getView()
- Returns the Viewports one child or null.
setView
public void setView(Component x)
- Sets the Viewports one lightweight child, x can be null.
getViewSize
public Dimension getViewSize()
- If the views size hasn't been explicitly set return the
preferred size, otherwise return the views current size.
If there's no view return 0,0.
setViewSize
public void setViewSize(Dimension newSize)
- Sets the view coordinates that appear in the upper left
hand corner of the viewport, null if there's no view.
getViewPosition
public Point getViewPosition()
- Returns the view coordinates that appear in the upper left
hand corner of the viewport, 0,0 if there's no view.
setViewPosition
public void setViewPosition(Point p)
- Sets the view coordinates that appear in the upper left
hand corner of the viewport, null if there's no view.
getViewRect
public Rectangle getViewRect()
- Return a rectangle whose origin is getViewPosition and size is
getExtentSize(). This is the visible part of the view, in view
coordinates.
- Returns:
- The visible part of the view, in view coordinates.
computeBlit
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. The blit* parameters are returned.
getExtentSize
public Dimension getExtentSize()
- Returns the size of the visible part of the view in view coordinates.
toViewCoordinates
public Dimension toViewCoordinates(Dimension size)
- Convert a size in pixel coordinates to view coordinates.
Subclasses of viewport that support "logical coordinates"
will override this method.
toViewCoordinates
public Point toViewCoordinates(Point p)
- Convert a point in pixel coordinates to view coordinates.
Subclasses of viewport that support "logical coordinates"
will override this method.
setExtentSize
public void setExtentSize(Dimension newExtent)
- Set the size of the visible part of the view, newExtent is
in view coordinates.
createViewListener
protected JViewport. ViewListener createViewListener()
addChangeListener
public void addChangeListener(ChangeListener l)
- Adds a ChangeListener to the button.
removeChangeListener
public void removeChangeListener(ChangeListener l)
- Removes a ChangeListener from the button.
fireStateChanged
protected void fireStateChanged()
createLayoutManager
protected LayoutManager createLayoutManager()
- Subclassers can override this to install a different
layout manager (or null) in the constructor. Returns
a new JViewportLayout object.
getAccessibleRole
public AccessibleRole getAccessibleRole()
- Get the role of this object.
- Returns:
- an instance of AccessibleRole describing the role of the object
- Overrides:
- getAccessibleRole in class JComponent
- See Also:
- AccessibleRole
All Packages Class Hierarchy This Package Previous Next Index