java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JViewport
The "viewport" or "porthole" through which you see the underlying information. When you scroll, what moves is the viewport. It is like peering through a camera's viewfinder. Moving the viewfinder upwards brings new things into view at the top of the picture and loses things that were at the bottom.
By default, JViewport is opaque. To change this, use the
setOpaque method.
NOTE:We have implemented a faster scrolling algorithm that does not require a buffer to draw in. The algorithm works as follows:
JComponents,
if they aren't, stop and repaint the whole viewport.
copyArea
on the scrolled region.
copyAreas.
Compared to the non backing store case this
approach will greatly reduce the painted region.
This approach can cause slower times than the backing store approach when the viewport is obscured by another window, or partially offscreen. When another window obscures the viewport the copyArea will copy garbage and a paint event will be generated by the system to inform us we need to paint the newly exposed region. The only way to handle this is to repaint the whole viewport, which can cause slower performance than the backing store case. In most applications very rarely will the user be scrolling while the viewport is obscured by another window or offscreen, so this optimization is usually worth the performance hit when obscured. Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
JScrollPane, Serialized Form
| Inner Class Summary | |
protected class |
JViewport.AccessibleJViewport
JViewport.AccessibleJViewport
|
protected class |
JViewport.ViewListener
JViewport.ViewListener
|
| Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
| Inner classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
| Inner classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent |
| Field Summary | |
protected boolean |
backingStore
copy-> backingStore
|
static int |
BACKINGSTORE_SCROLL_MODE
copy-> BACKINGSTORE_SCROLL_MODE
|
protected Image |
backingStoreImage
copy-> backingStoreImage
|
static int |
BLIT_SCROLL_MODE
copy-> BLIT_SCROLL_MODE
|
protected boolean |
isViewSizeSet
copy-> isViewSizeSet
|
protected Point |
lastPaintPosition
copy-> lastPaintPosition
|
protected boolean |
scrollUnderway
copy-> scrollUnderway
|
static int |
SIMPLE_SCROLL_MODE
copy-> SIMPLE_SCROLL_MODE
|
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
JViewport
copy-> new JViewport()copy-> <JViewport var> = new JViewport();
|
|
| Method Summary | |
void |
addChangeListener(ChangeListener l)
copy-> .addChangeListener( )copy-> <JViewport>.addChangeListener(<ChangeListener l>);
|
protected void |
addImpl(Component child,
Object constraints,
int index)
copy-> .addImpl(, , )copy-> <JViewport>.addImpl(<Component child>, <Object constraints>, <int index>);
|
protected boolean |
computeBlit(int dx,
int dy,
Point blitFrom,
Point blitTo,
Dimension blitSize,
Rectangle blitPaint)
copy-> .computeBlit(, , , , , )copy-> <boolean var>=<JViewport>.computeBlit(<int dx>, <int dy>, <Point blitFrom>, <Point blitTo>, <Dimension blitSize>, <Rectangle blitPaint>);
|
protected LayoutManager |
createLayoutManager()
copy-> .createLayoutManager()copy-> <LayoutManager var>=<JViewport>.createLayoutManager();
|
protected JViewport.ViewListener |
createViewListener()
copy-> .createViewListener()copy-> <JViewport.ViewListener var>=<JViewport>.createViewListener();
|
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
copy-> .firePropertyChange(, , )copy-> <JViewport>.firePropertyChange(<String propertyName>, <Object oldValue>, <Object newValue>);
|
protected void |
fireStateChanged()
copy-> .fireStateChanged()copy-> <JViewport>.fireStateChanged();
|
AccessibleContext |
getAccessibleContext()
copy-> .getAccessibleContext()copy-> <AccessibleContext var>=<JViewport>.getAccessibleContext();
|
Dimension |
getExtentSize()
copy-> .getExtentSize()copy-> <Dimension var>=<JViewport>.getExtentSize();
|
Insets |
getInsets()
copy-> .getInsets()copy-> <Insets var>=<JViewport>.getInsets();
|
Insets |
getInsets(Insets insets)
copy-> .getInsets( )copy-> <Insets var>=<JViewport>.getInsets(<Insets insets>);
|
int |
getScrollMode()
copy-> .getScrollMode()copy-> <int var>=<JViewport>.getScrollMode();
|
ViewportUI |
getUI()
copy-> .getUI()copy-> <ViewportUI var>=<JViewport>.getUI();
|
String |
getUIClassID()
copy-> .getUIClassID()copy-> <String var>=<JViewport>.getUIClassID();
|
Component |
getView()
copy-> .getView()copy-> <Component var>=<JViewport>.getView();
|
Point |
getViewPosition()
copy-> .getViewPosition()copy-> <Point var>=<JViewport>.getViewPosition();
|
Rectangle |
getViewRect()
copy-> .getViewRect()copy-> <Rectangle var>=<JViewport>.getViewRect();
|
Dimension |
getViewSize()
copy-> .getViewSize()copy-> <Dimension var>=<JViewport>.getViewSize();
|
boolean |
isBackingStoreEnabled()
copy-> .isBackingStoreEnabled()copy-> <boolean var>=<JViewport>.isBackingStoreEnabled();
|
boolean |
isOptimizedDrawingEnabled()
copy-> .isOptimizedDrawingEnabled()copy-> <boolean var>=<JViewport>.isOptimizedDrawingEnabled();
|
void |
paint(Graphics g)
copy-> .paint( )copy-> <JViewport>.paint(<Graphics g>);
|
protected String |
paramString()
copy-> .paramString()copy-> <String var>=<JViewport>.paramString();
|
void |
remove(Component child)
copy-> .remove( )copy-> <JViewport>.remove(<Component child>);
|
void |
removeChangeListener(ChangeListener l)
copy-> .removeChangeListener( )copy-> <JViewport>.removeChangeListener(<ChangeListener l>);
|
void |
repaint(long tm,
int x,
int y,
int w,
int h)
copy-> .repaint(, , , , )copy-> <JViewport>.repaint(<long tm>, <int x>, <int y>, <int w>, <int h>);
|
void |
reshape(int x,
int y,
int w,
int h)
copy-> .reshape(, , , )copy-> <JViewport>.reshape(<int x>, <int y>, <int w>, <int h>);
|
void |
scrollRectToVisible(Rectangle contentRect)
copy-> .scrollRectToVisible( )copy-> <JViewport>.scrollRectToVisible(<Rectangle contentRect>);
|
void |
setBackingStoreEnabled(boolean enabled)
copy-> .setBackingStoreEnabled( )copy-> <JViewport>.setBackingStoreEnabled(<boolean enabled>);
|
void |
setBorder(Border border)
copy-> .setBorder( )copy-> <JViewport>.setBorder(<Border border>);
|
void |
setExtentSize(Dimension newExtent)
copy-> .setExtentSize( )copy-> <JViewport>.setExtentSize(<Dimension newExtent>);
|
void |
setScrollMode(int mode)
copy-> .setScrollMode( )copy-> <JViewport>.setScrollMode(<int mode>);
|
void |
setUI(ViewportUI ui)
copy-> .setUI( )copy-> <JViewport>.setUI(<ViewportUI ui>);
|
void |
setView(Component view)
copy-> .setView( )copy-> <JViewport>.setView(<Component view>);
|
void |
setViewPosition(Point p)
copy-> .setViewPosition( )copy-> <JViewport>.setViewPosition(<Point p>);
|
void |
setViewSize(Dimension newSize)
copy-> .setViewSize( )copy-> <JViewport>.setViewSize(<Dimension newSize>);
|
Dimension |
toViewCoordinates(Dimension size)
copy-> .toViewCoordinates( )copy-> <Dimension var>=<JViewport>.toViewCoordinates(<Dimension size>);
|
Point |
toViewCoordinates(Point p)
copy-> .toViewCoordinates( )copy-> <Point var>=<JViewport>.toViewCoordinates(<Point p>);
|
void |
updateUI()
copy-> .updateUI()copy-> <JViewport>.updateUI();
|