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

Variable Index

 o backingStore
 o backingStoreGraphics
 o backingStoreImage
 o changeEvent
 o changeListener
 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)
ChangeListeners are notified whenever the views position or extent size changes.
 o computeBlit(Point, Point, 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 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 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)
If backingStore is enabled, paint to the backingStore Image and blit that to the screen.
 o remove(Component)
 o removeChangeListener(ChangeListener)
 o repaint(long, int, int, int, int)
If we're in the middle of a setViewPosition() call and backingStore is turned on, then attempt to blit the common part of the old view and the new one.
 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)
 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 backingStoreGraphics
 protected Graphics backingStoreGraphics
 o scrollUnderway
 protected boolean scrollUnderway
 o viewListener
 protected ComponentListener viewListener
 o changeListener
 protected ChangeListener changeListener
 o changeEvent
 protected 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)
If backingStore is enabled, paint to the backingStore Image and blit that to the screen.

Overrides:
paint in class JComponent
 o setBounds
 public void setBounds(int x,
                       int y,
                       int w,
                       int h)
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 repaint
 public void repaint(long t,
                     int x,
                     int y,
                     int w,
                     int h)
If we're in the middle of a setViewPosition() call and backingStore is turned on, then attempt to blit the common part of the old view and the new one.

Overrides:
repaint in class JComponent
 o computeBlit
 protected boolean computeBlit(Point oldLoc,
                               Point newLoc,
                               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 x)
ChangeListeners are notified whenever the views position or extent size changes.

 o removeChangeListener
 public void removeChangeListener(ChangeListener x)
 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.


All Packages  Class Hierarchy  This Package  Previous  Next  Index