jdk/src/share/classes/javax/swing/text/JTextComponent.java
changeset 3737 83fb4621a129
parent 3084 67ca55732362
child 3750 4195b035138f
equal deleted inserted replaced
3736:b82a1864410d 3737:83fb4621a129
  2067      *
  2067      *
  2068      * @return true if a viewport should force the <code>Scrollable</code>s
  2068      * @return true if a viewport should force the <code>Scrollable</code>s
  2069      *   width to match its own
  2069      *   width to match its own
  2070      */
  2070      */
  2071     public boolean getScrollableTracksViewportWidth() {
  2071     public boolean getScrollableTracksViewportWidth() {
  2072         if (getParent() instanceof JViewport) {
  2072         JViewport port = SwingUtilities2.getViewport(this);
  2073             return (getParent().getWidth() > getPreferredSize().width);
  2073         if (port != null) {
       
  2074             return port.getWidth() > getPreferredSize().width;
  2074         }
  2075         }
  2075         return false;
  2076         return false;
  2076     }
  2077     }
  2077 
  2078 
  2078     /**
  2079     /**
  2087      *
  2088      *
  2088      * @return true if a viewport should force the Scrollables height
  2089      * @return true if a viewport should force the Scrollables height
  2089      *   to match its own
  2090      *   to match its own
  2090      */
  2091      */
  2091     public boolean getScrollableTracksViewportHeight() {
  2092     public boolean getScrollableTracksViewportHeight() {
  2092         if (getParent() instanceof JViewport) {
  2093         JViewport port = SwingUtilities2.getViewport(this);
  2093             return (getParent().getHeight() > getPreferredSize().height);
  2094         if (port != null) {
       
  2095             return (port.getHeight() > getPreferredSize().height);
  2094         }
  2096         }
  2095         return false;
  2097         return false;
  2096     }
  2098     }
  2097 
  2099 
  2098 
  2100