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
-
backingStore
-
-
backingStoreGraphics
-
-
backingStoreImage
-
-
changeEvent
-
-
changeListener
-
-
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)
- ChangeListeners are notified whenever the views position or
extent size changes.
-
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.
-
createLayoutManager()
- Subclassers can override this to install a different
layout manager (or null) in the constructor.
-
createViewListener()
-
-
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.
-
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)
- If backingStore is enabled, paint to the backingStore Image and
blit that to the screen.
-
remove(Component)
-
-
removeChangeListener(ChangeListener)
-
-
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.
-
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)
-
-
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
backingStoreGraphics
protected Graphics backingStoreGraphics
scrollUnderway
protected boolean scrollUnderway
viewListener
protected ComponentListener viewListener
changeListener
protected ChangeListener changeListener
changeEvent
protected 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)
- If backingStore is enabled, paint to the backingStore Image and
blit that to the screen.
- Overrides:
- paint in class JComponent
setBounds
public void setBounds(int x,
int y,
int w,
int h)
- 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.
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
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.
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 x)
- ChangeListeners are notified whenever the views position or
extent size changes.
removeChangeListener
public void removeChangeListener(ChangeListener x)
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