Home » openjdk-7 » javax » swing » [javadoc | source]
public class: JViewport [javadoc | source]

All Implemented Interfaces:
    Accessible, HasGetTransferHandler, Serializable, MenuContainer, ImageObserver

Direct Known Subclasses:

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:

  1. The view and parent view and checked to see if they are JComponents, if they aren't, stop and repaint the whole viewport.
  2. If the viewport is obscured by an ancestor, stop and repaint the whole viewport.
  3. Compute the region that will become visible, if it is as big as the viewport, stop and repaint the whole view region.
  4. Obtain the ancestor Window's graphics and do a copyArea on the scrolled region.
  5. Message the view to repaint the newly visible region.
  6. The next time paint is invoked on the viewport, if the clip region is smaller than the viewport size a timer is kicked off to repaint the whole region.
In general this approach is much faster. Compared to the backing store approach this avoids the overhead of maintaining an offscreen buffer and having to do two 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: Swing is not thread safe. For more information see Swing's Threading Policy.

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. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder .

Nested Class Summary:
protected class  JViewport.ViewListener  A listener for the view.

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. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}. 

protected class  JViewport.AccessibleJViewport  This class implements accessibility support for the JViewport class. It provides an implementation of the Java Accessibility API appropriate to viewport user-interface elements.

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. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}. 

Field Summary
static final  Object EnableWindowBlit    Property used to indicate window blitting should not be done. 
protected  boolean isViewSizeSet    True when the viewport dimensions have been determined. The default is false. 
protected  Point lastPaintPosition    The last viewPosition that we've painted, so we know how much of the backing store image is valid. 
protected  boolean backingStore    True when this viewport is maintaining an offscreen image of its contents, so that some scrolling can take place using fast "bit-blit" operations instead of by accessing the view object to construct the display. The default is false. 
protected transient  Image backingStoreImage    The view image used for a backing store. 
protected  boolean scrollUnderway    The scrollUnderway flag is used for components like JList. When the downarrow key is pressed on a JList and the selected cell is the last in the list, the scrollpane autoscrolls. Here, the old selected cell needs repainting and so we need a flag to make the viewport do the optimized painting only when there is an explicit call to setViewPosition(Point). When setBounds is called through other routes, the flag is off and the view repaints normally. Another approach would be to remove this from the JViewport class and have the JList manage this case by using setBackingStoreEnabled. The default is false
public static final  int BLIT_SCROLL_MODE    Use graphics.copyArea to implement scrolling. This is the fastest for most applications. 
public static final  int BACKINGSTORE_SCROLL_MODE    Draws viewport contents into an offscreen image. This was previously the default mode for JTable. This mode may offer advantages over "blit mode" in some cases, but it requires a large chunk of extra RAM. 
public static final  int SIMPLE_SCROLL_MODE    This mode uses the very simple method of redrawing the entire contents of the scrollpane each time it is scrolled. This was the default behavior in Swing 1.0 and Swing 1.1. Either of the other two options will provide better performance in most cases. 
Fields inherited from javax.swing.JComponent:
Fields inherited from java.awt.Container:
layoutMgr,  containerListener,  listeningChildren,  listeningBoundsChildren,  descendantsCount,  preserveBackgroundColor,  INCLUDE_SELF,  SEARCH_HEAVYWEIGHTS,  modalComp,  modalAppContext
Fields inherited from java.awt.Component:
peer,  parent,  appContext,  x,  y,  width,  height,  foreground,  background,  font,  peerFont,  cursor,  locale,  bufferStrategy,  ignoreRepaint,  visible,  enabled,  dropTarget,  popups,  focusTraversalKeys,  LOCK,  minSize,  minSizeSet,  prefSize,  prefSizeSet,  maxSize,  maxSizeSet,  componentOrientation,  newEventsOnly,  componentListener,  focusListener,  hierarchyListener,  hierarchyBoundsListener,  keyListener,  mouseListener,  mouseMotionListener,  mouseWheelListener,  inputMethodListener,  windowClosingException,  actionListenerK,  adjustmentListenerK,  componentListenerK,  containerListenerK,  focusListenerK,  itemListenerK,  keyListenerK,  mouseListenerK,  mouseMotionListenerK,  mouseWheelListenerK,  textListenerK,  ownedWindowK,  windowListenerK,  inputMethodListenerK,  hierarchyListenerK,  hierarchyBoundsListenerK,  windowStateListenerK,  windowFocusListenerK,  eventMask,  isInc,  incRate,  TOP_ALIGNMENT,  CENTER_ALIGNMENT,  BOTTOM_ALIGNMENT,  LEFT_ALIGNMENT,  RIGHT_ALIGNMENT,  isPacked,  backgroundEraseDisabled,  eventCache,  accessibleContext
 public JViewport() 
Method from javax.swing.JViewport Summary:
addChangeListener,   addImpl,   computeBlit,   createLayoutManager,   createViewListener,   firePropertyChange,   fireStateChanged,   getAccessibleContext,   getChangeListeners,   getExtentSize,   getInsets,   getInsets,   getScrollMode,   getUI,   getUIClassID,   getView,   getViewPosition,   getViewRect,   getViewSize,   isBackingStoreEnabled,   isOptimizedDrawingEnabled,   isPaintingOrigin,   paint,   paramString,   remove,   removeChangeListener,   repaint,   reshape,   scrollRectToVisible,   setBackingStoreEnabled,   setBorder,   setExtentSize,   setScrollMode,   setUI,   setView,   setViewPosition,   setViewSize,   toViewCoordinates,   toViewCoordinates,   updateUI
Methods from javax.swing.JComponent:
_paintImmediately,   addAncestorListener,   addNotify,   addVetoableChangeListener,   alwaysOnTop,   checkIfChildObscuredBySibling,   clientPropertyChanged,   compWriteObjectNotify,   componentInputMapChanged,   computeVisibleRect,   computeVisibleRect,   contains,   createToolTip,   disable,   dndDone,   dropLocationForPoint,   enable,   firePropertyChange,   firePropertyChange,   firePropertyChange,   fireVetoableChange,   getAccessibleContext,   getActionForKeyStroke,   getActionMap,   getActionMap,   getAlignmentX,   getAlignmentY,   getAncestorListeners,   getAutoscrolls,   getBaseline,   getBaselineResizeBehavior,   getBorder,   getBounds,   getClientProperty,   getComponentGraphics,   getComponentPopupMenu,   getConditionForKeyStroke,   getCreatedDoubleBuffer,   getDebugGraphicsOptions,   getDefaultLocale,   getFontMetrics,   getGraphics,   getGraphicsInvoked,   getHeight,   getInheritsPopupMenu,   getInputMap,   getInputMap,   getInputMap,   getInputVerifier,   getInsets,   getInsets,   getListeners,   getLocation,   getManagingFocusBackwardTraversalKeys,   getManagingFocusForwardTraversalKeys,   getMaximumSize,   getMinimumSize,   getNextFocusableComponent,   getPopupLocation,   getPreferredSize,   getRegisteredKeyStrokes,   getRootPane,   getSize,   getToolTipLocation,   getToolTipText,   getToolTipText,   getTopLevelAncestor,   getTransferHandler,   getUIClassID,   getVerifyInputWhenFocusTarget,   getVetoableChangeListeners,   getVisibleRect,   getWidth,   getWriteObjCounter,   getX,   getY,   grabFocus,   isDoubleBuffered,   isLightweightComponent,   isManagingFocus,   isOpaque,   isOptimizedDrawingEnabled,   isPainting,   isPaintingForPrint,   isPaintingOrigin,   isPaintingTile,   isRequestFocusEnabled,   isValidateRoot,   paint,   paintBorder,   paintChildren,   paintComponent,   paintForceDoubleBuffered,   paintImmediately,   paintImmediately,   paintToOffscreen,   paramString,   print,   printAll,   printBorder,   printChildren,   printComponent,   processComponentKeyEvent,   processKeyBinding,   processKeyBindings,   processKeyBindingsForAllComponents,   processKeyEvent,   processMouseEvent,   processMouseMotionEvent,   putClientProperty,   rectangleIsObscured,   registerKeyboardAction,   registerKeyboardAction,   removeAncestorListener,   removeNotify,   removeVetoableChangeListener,   repaint,   repaint,   requestDefaultFocus,   requestFocus,   requestFocus,   requestFocusInWindow,   requestFocusInWindow,   resetKeyboardActions,   reshape,   revalidate,   safelyGetGraphics,   safelyGetGraphics,   scrollRectToVisible,   setActionMap,   setAlignmentX,   setAlignmentY,   setAutoscrolls,   setBackground,   setBorder,   setComponentPopupMenu,   setCreatedDoubleBuffer,   setDebugGraphicsOptions,   setDefaultLocale,   setDoubleBuffered,   setDropLocation,   setEnabled,   setFocusTraversalKeys,   setFont,   setForeground,   setInheritsPopupMenu,   setInputMap,   setInputVerifier,   setMaximumSize,   setMinimumSize,   setNextFocusableComponent,   setOpaque,   setPaintingChild,   setPreferredSize,   setRequestFocusEnabled,   setToolTipText,   setTransferHandler,   setUI,   setUIProperty,   setVerifyInputWhenFocusTarget,   setVisible,   setWriteObjCounter,   shouldDebugGraphics,   superProcessMouseMotionEvent,   unregisterKeyboardAction,   update,   updateUI
Methods from java.awt.Container:
add,   add,   add,   add,   add,   addContainerListener,   addImpl,   addNotify,   addPropertyChangeListener,   addPropertyChangeListener,   adjustDecendantsOnParent,   adjustDescendants,   adjustListeningChildren,   applyComponentOrientation,   areFocusTraversalKeysSet,   canContainFocusOwner,   checkGD,   clearCurrentFocusCycleRootOnHide,   clearMostRecentFocusOwnerOnHide,   containsFocus,   countComponents,   countHierarchyMembers,   createChildHierarchyEvents,   createHierarchyEvents,   decreaseComponentCount,   deliverEvent,   dispatchEventImpl,   dispatchEventToSelf,   doLayout,   eventEnabled,   findComponentAt,   findComponentAt,   findComponentAt,   findComponentAtImpl,   getAccessibleAt,   getAccessibleChild,   getAccessibleChildrenCount,   getAlignmentX,   getAlignmentY,   getComponent,   getComponentAt,   getComponentAt,   getComponentCount,   getComponentZOrder,   getComponents,   getComponentsSync,   getComponents_NoClientCode,   getContainerListeners,   getDropTargetEventTarget,   getFocusTraversalKeys,   getFocusTraversalPolicy,   getHeavyweightContainer,   getInsets,   getLayout,   getListeners,   getMaximumSize,   getMinimumSize,   getMouseEventTarget,   getMousePosition,   getOpaqueShape,   getPreferredSize,   getTraversalRoot,   hasHeavyweightDescendants,   hasLightweightDescendants,   increaseComponentCount,   initializeFocusTraversalKeys,   insets,   invalidate,   invalidateParent,   invalidateTree,   isAncestorOf,   isFocusCycleRoot,   isFocusCycleRoot,   isFocusTraversalPolicyProvider,   isFocusTraversalPolicySet,   isRecursivelyVisibleUpToHeavyweightContainer,   isSameOrAncestorOf,   isValidateRoot,   layout,   lightweightPaint,   lightweightPrint,   list,   list,   locate,   minimumSize,   mixOnHiding,   mixOnReshaping,   mixOnShowing,   mixOnValidating,   mixOnZOrderChanging,   numListening,   paint,   paintComponents,   paintHeavyweightComponents,   paramString,   postProcessKeyEvent,   postsOldMouseEvents,   preProcessKeyEvent,   preferredSize,   print,   printComponents,   printHeavyweightComponents,   processContainerEvent,   processEvent,   proxyEnableEvents,   recursiveApplyCurrentShape,   recursiveApplyCurrentShape,   recursiveApplyCurrentShape,   recursiveSubtractAndApplyShape,   recursiveSubtractAndApplyShape,   recursiveSubtractAndApplyShape,   remove,   remove,   removeAll,   removeContainerListener,   removeNotify,   setComponentZOrder,   setFocusCycleRoot,   setFocusTraversalKeys,   setFocusTraversalPolicy,   setFocusTraversalPolicyProvider,   setFont,   setLayout,   transferFocusDownCycle,   update,   updateGraphicsData,   validate,   validateTree,   validateUnconditionally
Methods from java.awt.Component:
action,   add,   addComponentListener,   addFocusListener,   addHierarchyBoundsListener,   addHierarchyListener,   addInputMethodListener,   addKeyListener,   addMouseListener,   addMouseMotionListener,   addMouseWheelListener,   addNotify,   addPropertyChangeListener,   addPropertyChangeListener,   adjustListeningChildrenOnParent,   applyComponentOrientation,   applyCompoundShape,   applyCurrentShape,   areBoundsValid,   areFocusTraversalKeysSet,   areInputMethodsEnabled,   autoProcessMouseWheel,   bounds,   canBeFocusOwner,   canBeFocusOwnerRecursively,   checkGD,   checkImage,   checkImage,   checkTreeLock,   checkWindowClosingException,   clearCurrentFocusCycleRootOnHide,   clearMostRecentFocusOwnerOnHide,   coalesceEvents,   constructComponentName,   contains,   contains,   containsFocus,   countHierarchyMembers,   createBufferStrategy,   createBufferStrategy,   createHierarchyEvents,   createImage,   createImage,   createVolatileImage,   createVolatileImage,   deliverEvent,   disable,   disableEvents,   dispatchEvent,   dispatchEventImpl,   dispatchMouseWheelToAncestor,   doLayout,   enable,   enable,   enableEvents,   enableInputMethods,   eventEnabled,   eventTypeEnabled,   findUnderMouseInWindow,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   getAccessControlContext,   getAccessibleContext,   getAccessibleIndexInParent,   getAccessibleStateSet,   getAlignmentX,   getAlignmentY,   getBackBuffer,   getBackground,   getBaseline,   getBaselineResizeBehavior,   getBounds,   getBounds,   getBoundsOp,   getBufferStrategy,   getColorModel,   getComponentAt,   getComponentAt,   getComponentListeners,   getComponentOrientation,   getContainer,   getContainingWindow,   getCursor,   getCursor_NoClientCode,   getDropTarget,   getFocusCycleRootAncestor,   getFocusListeners,   getFocusTraversalKeys,   getFocusTraversalKeysEnabled,   getFocusTraversalKeys_NoIDCheck,   getFont,   getFontMetrics,   getFont_NoClientCode,   getForeground,   getGraphics,   getGraphicsConfiguration,   getGraphicsConfiguration_NoClientCode,   getGraphics_NoClientCode,   getHWPeerAboveMe,   getHeight,   getHierarchyBoundsListeners,   getHierarchyListeners,   getIgnoreRepaint,   getInputContext,   getInputMethodListeners,   getInputMethodRequests,   getKeyListeners,   getListeners,   getLocale,   getLocation,   getLocation,   getLocationOnScreen,   getLocationOnScreen_NoTreeLock,   getLocationOnWindow,   getMaximumSize,   getMinimumSize,   getMouseListeners,   getMouseMotionListeners,   getMousePosition,   getMouseWheelListeners,   getName,   getNativeContainer,   getNextFocusCandidate,   getNormalShape,   getObjectLock,   getOpaqueShape,   getParent,   getParent_NoClientCode,   getPeer,   getPreferredSize,   getPropertyChangeListeners,   getPropertyChangeListeners,   getSiblingIndexAbove,   getSiblingIndexBelow,   getSize,   getSize,   getToolkit,   getToolkitImpl,   getTraversalRoot,   getTreeLock,   getWidth,   getX,   getY,   gotFocus,   handleEvent,   hasFocus,   hide,   imageUpdate,   initializeFocusTraversalKeys,   inside,   invalidate,   invalidateIfValid,   invalidateParent,   isAutoFocusTransferOnDisposal,   isBackgroundSet,   isCoalescingEnabled,   isCursorSet,   isDisplayable,   isDoubleBuffered,   isEnabled,   isEnabledImpl,   isFocusCycleRoot,   isFocusOwner,   isFocusTraversable,   isFocusTraversableOverridden,   isFocusable,   isFontSet,   isForegroundSet,   isInstanceOf,   isLightweight,   isMaximumSizeSet,   isMinimumSizeSet,   isMixingNeeded,   isNonOpaqueForMixing,   isOpaque,   isPreferredSizeSet,   isRecursivelyVisible,   isSameOrAncestorOf,   isShowing,   isValid,   isVisible,   isVisible_NoClientCode,   keyDown,   keyUp,   layout,   lightweightPaint,   lightweightPrint,   list,   list,   list,   list,   list,   locate,   location,   lostFocus,   minimumSize,   mixOnHiding,   mixOnReshaping,   mixOnShowing,   mixOnValidating,   mixOnZOrderChanging,   mouseDown,   mouseDrag,   mouseEnter,   mouseExit,   mouseMove,   mouseUp,   move,   nextFocus,   numListening,   paint,   paintAll,   paintHeavyweightComponents,   paramString,   pointRelativeToComponent,   postEvent,   postsOldMouseEvents,   preferredSize,   prepareImage,   prepareImage,   print,   printAll,   printHeavyweightComponents,   processComponentEvent,   processEvent,   processFocusEvent,   processHierarchyBoundsEvent,   processHierarchyEvent,   processInputMethodEvent,   processKeyEvent,   processMouseEvent,   processMouseMotionEvent,   processMouseWheelEvent,   relocateComponent,   remove,   removeComponentListener,   removeFocusListener,   removeHierarchyBoundsListener,   removeHierarchyListener,   removeInputMethodListener,   removeKeyListener,   removeMouseListener,   removeMouseMotionListener,   removeMouseWheelListener,   removeNotify,   removePropertyChangeListener,   removePropertyChangeListener,   repaint,   repaint,   repaint,   repaint,   requestFocus,   requestFocus,   requestFocus,   requestFocus,   requestFocusHelper,   requestFocusHelper,   requestFocusInWindow,   requestFocusInWindow,   requestFocusInWindow,   requestFocusInWindow,   reshape,   resize,   resize,   revalidate,   setAutoFocusTransferOnDisposal,   setBackground,   setBounds,   setBounds,   setBoundsOp,   setComponentOrientation,   setCursor,   setDropTarget,   setEnabled,   setFocusTraversalKeys,   setFocusTraversalKeysEnabled,   setFocusTraversalKeys_NoIDCheck,   setFocusable,   setFont,   setForeground,   setGraphicsConfiguration,   setIgnoreRepaint,   setLocale,   setLocation,   setLocation,   setMaximumSize,   setMinimumSize,   setName,   setPreferredSize,   setRequestFocusController,   setSize,   setSize,   setVisible,   show,   show,   size,   subtractAndApplyShape,   subtractAndApplyShapeBelowMe,   toString,   transferFocus,   transferFocus,   transferFocusBackward,   transferFocusBackward,   transferFocusUpCycle,   update,   updateCursorImmediately,   updateGraphicsData,   updateZOrder,   validate
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.JViewport Detail:
 public  void addChangeListener(ChangeListener l) 
    Adds a ChangeListener to the list that is notified each time the view's size, position, or the viewport's extent size has changed.
 protected  void addImpl(Component child,
    Object constraints,
    int index) 
    Sets the JViewport's one lightweight child, which can be null. (Since there is only one child which occupies the entire viewport, the constraints and index arguments are ignored.)
 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 parameters are modified to return the values required for the blit.
 protected LayoutManager createLayoutManager() 
    Subclassers can override this to install a different layout manager (or null) in the constructor. Returns the LayoutManager to install on the JViewport.
 protected ViewListener createViewListener() 
    Creates a listener for the view.
 protected  void firePropertyChange(String propertyName,
    Object oldValue,
    Object newValue) 
    Notifies listeners of a property change. This is subclassed to update the windowBlit property. (The putClientProperty property is final).
 protected  void fireStateChanged() 
    Notifies all ChangeListeners when the views size, position, or the viewports extent size has changed.
 public AccessibleContext getAccessibleContext() 
    Gets the AccessibleContext associated with this JViewport. For viewports, the AccessibleContext takes the form of an AccessibleJViewport. A new AccessibleJViewport instance is created if necessary.
 public ChangeListener[] getChangeListeners() 
    Returns an array of all the ChangeListeners added to this JViewport with addChangeListener().
 public Dimension getExtentSize() 
    Returns the size of the visible part of the view in view coordinates.
 public final Insets getInsets() 
    Returns the insets (border) dimensions as (0,0,0,0), since borders are not supported on a JViewport.
 public final Insets getInsets(Insets insets) 
    Returns an Insets object containing this JViewports inset values. The passed-in Insets object will be reinitialized, and all existing values within this object are overwritten.
 public int getScrollMode() 
    Returns the current scrolling mode.
 public ViewportUI getUI() 
    Returns the L&F object that renders this component.
 public String getUIClassID() 
    Returns a string that specifies the name of the L&F class that renders this component.
 public Component getView() 
    Returns the JViewport's one child or null.
 public Point getViewPosition() 
    Returns the view coordinates that appear in the upper left hand corner of the viewport, or 0,0 if there's no view.
 public Rectangle getViewRect() 
    Returns a rectangle whose origin is getViewPosition and size is getExtentSize. This is the visible part of the view, in view coordinates.
 public Dimension getViewSize() 
    If the view's size hasn't been explicitly set, return the preferred size, otherwise return the view's current size. If there is no view, return 0,0.
 public boolean isBackingStoreEnabled() 
Deprecated! As - of Java 2 platform v1.3, replaced by getScrollMode().

    Returns true if this viewport is maintaining an offscreen image of its contents.
 public boolean isOptimizedDrawingEnabled() 
    The JViewport overrides the default implementation of this method (in JComponent) to return false. This ensures that the drawing machinery will call the Viewport's paint implementation rather than messaging the JViewport's children directly.
 protected boolean isPaintingOrigin() 
    Returns true if scroll mode is a {@code BACKINGSTORE_SCROLL_MODE} to cause painting to originate from {@code JViewport}, or one of its ancestors. Otherwise returns {@code false}.
 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.
    The term "blit" is the pronounced version of the PDP-10 BLT (BLock Transfer) instruction, which copied a block of bits. (In case you were curious.)
 protected String paramString() 
    Returns a string representation of this JViewport. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.
 public  void remove(Component child) 
    Removes the Viewports one lightweight child.
 public  void removeChangeListener(ChangeListener l) 
    Removes a ChangeListener from the list that's notified each time the views size, position, or the viewports extent size has changed.
 public  void repaint(long tm,
    int x,
    int y,
    int w,
    int h) 
    Always repaint in the parents coordinate system to make sure only one paint is performed by the RepaintManager.
 public  void reshape(int x,
    int y,
    int w,
    int h) 
    Sets the bounds of this viewport. If the viewport's width or height has changed, fire a StateChanged event.
 public  void scrollRectToVisible(Rectangle contentRect) 
    Scrolls the view so that Rectangle within the view becomes visible.

    This attempts to validate the view before scrolling if the view is currently not valid - isValid returns false. To avoid excessive validation when the containment hierarchy is being created this will not validate if one of the ancestors does not have a peer, or there is no validate root ancestor, or one of the ancestors is not a Window or Applet.

    Note that this method will not scroll outside of the valid viewport; for example, if contentRect is larger than the viewport, scrolling will be confined to the viewport's bounds.

 public  void setBackingStoreEnabled(boolean enabled) 
Deprecated! As - of Java 2 platform v1.3, replaced by setScrollMode().

    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.
 public final  void setBorder(Border border) 
    The viewport "scrolls" its child (called the "view") by the normal parent/child clipping (typically the view is moved in the opposite direction of the scroll). A non-null border, or non-zero insets, isn't supported, to prevent the geometry of this component from becoming complex enough to inhibit subclassing. To create a JViewport with a border, add it to a JPanel that has a border.

    Note: If border is non-null, this method will throw an exception as borders are not supported on a JViewPort.

 public  void setExtentSize(Dimension newExtent) 
    Sets the size of the visible part of the view using view coordinates.
 public  void setScrollMode(int mode) 
    Used to control the method of scrolling the viewport contents. You may want to change this mode to get maximum performance for your use case.
 public  void setUI(ViewportUI ui) 
    Sets the L&F object that renders this component.
 public  void setView(Component view) 
    Sets the JViewport's one lightweight child (view), which can be null.
 public  void setViewPosition(Point p) 
    Sets the view coordinates that appear in the upper left hand corner of the viewport, does nothing if there's no view.
 public  void setViewSize(Dimension newSize) 
    Sets the size of the view. A state changed event will be fired.
 public Dimension toViewCoordinates(Dimension size) 
    Converts a size in pixel coordinates to view coordinates. Subclasses of viewport that support "logical coordinates" will override this method.
 public Point toViewCoordinates(Point p) 
    Converts a point in pixel coordinates to view coordinates. Subclasses of viewport that support "logical coordinates" will override this method.
 public  void updateUI() 
    Resets the UI property to a value from the current look and feel.