src/share/classes/javax/swing/JViewport.java

Print this page




 644     /**
 645      * The <code>JViewport</code> overrides the default implementation of
 646      * this method (in <code>JComponent</code>) to return false.
 647      * This ensures
 648      * that the drawing machinery will call the <code>Viewport</code>'s
 649      * <code>paint</code>
 650      * implementation rather than messaging the <code>JViewport</code>'s
 651      * children directly.
 652      *
 653      * @return false
 654      */
 655     public boolean isOptimizedDrawingEnabled() {
 656         return false;
 657     }
 658 
 659     /**
 660      * Returns true if scroll mode is a {@code BACKINGSTORE_SCROLL_MODE} to cause
 661      * painting to originate from {@code JViewport}, or one of its
 662      * ancestors. Otherwise returns {@code false}.
 663      *
 664      * @return true if if scroll mode is a {@code BACKINGSTORE_SCROLL_MODE}.
 665      * @see JComponent#isPaintingOrigin()
 666      */
 667     protected boolean isPaintingOrigin() {
 668         return scrollMode == BACKINGSTORE_SCROLL_MODE;
 669     }
 670 
 671 
 672     /**
 673      * Only used by the paint method below.
 674      */
 675     private Point getViewLocation() {
 676         Component view = getView();
 677         if (view != null) {
 678             return view.getLocation();
 679         }
 680         else {
 681             return new Point(0,0);
 682         }
 683     }
 684 




 644     /**
 645      * The <code>JViewport</code> overrides the default implementation of
 646      * this method (in <code>JComponent</code>) to return false.
 647      * This ensures
 648      * that the drawing machinery will call the <code>Viewport</code>'s
 649      * <code>paint</code>
 650      * implementation rather than messaging the <code>JViewport</code>'s
 651      * children directly.
 652      *
 653      * @return false
 654      */
 655     public boolean isOptimizedDrawingEnabled() {
 656         return false;
 657     }
 658 
 659     /**
 660      * Returns true if scroll mode is a {@code BACKINGSTORE_SCROLL_MODE} to cause
 661      * painting to originate from {@code JViewport}, or one of its
 662      * ancestors. Otherwise returns {@code false}.
 663      *
 664      * @return true if scroll mode is a {@code BACKINGSTORE_SCROLL_MODE}.
 665      * @see JComponent#isPaintingOrigin()
 666      */
 667     protected boolean isPaintingOrigin() {
 668         return scrollMode == BACKINGSTORE_SCROLL_MODE;
 669     }
 670 
 671 
 672     /**
 673      * Only used by the paint method below.
 674      */
 675     private Point getViewLocation() {
 676         Component view = getView();
 677         if (view != null) {
 678             return view.getLocation();
 679         }
 680         else {
 681             return new Point(0,0);
 682         }
 683     }
 684