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.


Variable Index

 o backingStore
 o backingStoreImage
 o changeEvent
 o isViewSizeSet
 o lastPaintPosition
The last viewPosition that we've painted, so we know how much of the backing store image is valid.
 o scrollUnderway
 o viewListener

Constructor Index

 o JViewport()

Method Index

 o add(Component)
Sets the Viewports one lightweight child, x can be null.
 o addChangeListener(ChangeListener)
Adds a ChangeListener to the button.
 o 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.
 o createLayoutManager()
Subclassers can override this to install a different layout manager (or null) in the constructor.
 o createViewListener()
 o fireStateChanged()
 o getAccessibleRole()
Get the role of this object.
 o getExtentSize()
Returns the size of the visible part of the view in view coordinates.
 o 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).
 o getView()
Returns the Viewports one child or null.
 o getViewPosition()
Returns the view coordinates that appear in the upper left hand corner of the viewport, 0,0 if there's no view.
 o getViewRect()
Return a rectangle whose origin is getViewPosition and size is getExtentSize().
 o getViewSize()
If the views size hasn't been explicitly set return the preferred size, otherwise return the views current size.
 o isBackingStoreEnabled()
Returns true if this viewport is maintaining an offscreen image of its contents.
 o 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.
 o remove(Component)
 o removeChangeListener(ChangeListener)
Removes a ChangeListener from the button.
 o scrollRectToVisible(Rectangle)
Overridden to scroll the View such that aRect within the View becomes visible.
 o setBackingStoreEnabled(boolean)
If true if this viewport will maintain an offscreen image of its contents.
 o setBounds(int, int, int, int)
Moves and resizes this component.
 o setExtentSize(Dimension)
Set the size of the visible part of the view, newExtent is in view coordinates.
 o setView(Component)
Sets the Viewports one lightweight child, x can be null.
 o setViewPosition(Point)
Sets the view coordinates that appear in the upper left hand corner of the viewport, null if there's no view.
 o setViewSize(Dimension)
Sets the view coordinates that appear in the upper left hand corner of the viewport, null if there's no view.
 o toViewCoordinates(Dimension)
Convert a size in pixel coordinates to view coordinates.
 o toViewCoordinates(Point)
Convert a point in pixel coordinates to view coordinates.

Variables

 o isViewSizeSet
 protected boolean isViewSizeSet
 o lastPaintPosition
 protected Point lastPaintPosition
The last viewPosition that we've painted, so we know how much of the backing store image is valid.

 o backingStore
 protected boolean backingStore
 o backingStoreImage
 protected Image backingStoreImage
 o scrollUnderway
 protected boolean scrollUnderway
 o viewListener
 protected ComponentListener viewListener
 o changeEvent
 protected transient ChangeEvent changeEvent

Constructors

 o JViewport
 public JViewport()

Methods

 o add
 public Component add(Component x)
Sets the Viewports one lightweight child, x can be null.

Overrides:
add in class Container
See Also:
setView
 o remove
 public void remove(Component x)
Overrides:
remove in class Container
 o scrollRectToVisible
 public void scrollRectToVisible(Rectangle contentRect)
Overridden to scroll the View such that aRect within the View becomes visible.

Overrides:
scrollRectToVisible in class JComponent
 o 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
 o 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
 o setBounds
 public void setBounds(int x,
                       int y,
                       int w,
                       int h)
Moves and resizes this component.

Overrides:
setBounds in class JComponent
 o isBackingStoreEnabled
 public boolean isBackingStoreEnabled()
Returns true if this viewport is maintaining an offscreen image of its contents.

 o 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.

 o getView
 public Component getView()
Returns the Viewports one child or null.

 o setView
 public void setView(Component x)
Sets the Viewports one lightweight child, x can be null.

 o 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.

 o 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.

 o 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.

 o 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.

 o 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.
 o 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.

 o getExtentSize
 public Dimension getExtentSize()
Returns the size of the visible part of the view in view coordinates.

 o 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.

 o 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.

 o setExtentSize
 public void setExtentSize(Dimension newExtent)
Set the size of the visible part of the view, newExtent is in view coordinates.

 o createViewListener
 protected JViewport. ViewListener createViewListener()
 o addChangeListener
 public void addChangeListener(ChangeListener l)
Adds a ChangeListener to the button.

 o removeChangeListener
 public void removeChangeListener(ChangeListener l)
Removes a ChangeListener from the button.

 o fireStateChanged
 protected void fireStateChanged()
 o createLayoutManager
 protected LayoutManager createLayoutManager()
Subclassers can override this to install a different layout manager (or null) in the constructor. Returns a new JViewportLayout object.

 o 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