< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


1766             return getElement().getEndOffset();
1767         }
1768 
1769         /**
1770          * Gets the element that this view is mapped to.
1771          *
1772          * @return the view
1773          */
1774         public Element getElement() {
1775             if (view != null) {
1776                 return view.getElement();
1777             }
1778             return editor.getDocument().getDefaultRootElement();
1779         }
1780 
1781         /**
1782          * Breaks this view on the given axis at the given length.
1783          *
1784          * @param axis may be either X_AXIS or Y_AXIS
1785          * @param len specifies where a break is desired in the span
1786          * @param the current allocation of the view
1787          * @return the fragment of the view that represents the given span
1788          *   if the view can be broken, otherwise null
1789          */
1790         public View breakView(int axis, float len, Shape a) {
1791             throw new Error("Can't break root view");
1792         }
1793 
1794         /**
1795          * Determines the resizability of the view along the
1796          * given axis.  A value of 0 or less is not resizable.
1797          *
1798          * @param axis may be either X_AXIS or Y_AXIS
1799          * @return the weight
1800          */
1801         public int getResizeWeight(int axis) {
1802             if (view != null) {
1803                 return view.getResizeWeight(axis);
1804             }
1805             return 0;
1806         }


   1 /*
   2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


1766             return getElement().getEndOffset();
1767         }
1768 
1769         /**
1770          * Gets the element that this view is mapped to.
1771          *
1772          * @return the view
1773          */
1774         public Element getElement() {
1775             if (view != null) {
1776                 return view.getElement();
1777             }
1778             return editor.getDocument().getDefaultRootElement();
1779         }
1780 
1781         /**
1782          * Breaks this view on the given axis at the given length.
1783          *
1784          * @param axis may be either X_AXIS or Y_AXIS
1785          * @param len specifies where a break is desired in the span
1786          * @param a the current allocation of the view
1787          * @return the fragment of the view that represents the given span
1788          *   if the view can be broken, otherwise null
1789          */
1790         public View breakView(int axis, float len, Shape a) {
1791             throw new Error("Can't break root view");
1792         }
1793 
1794         /**
1795          * Determines the resizability of the view along the
1796          * given axis.  A value of 0 or less is not resizable.
1797          *
1798          * @param axis may be either X_AXIS or Y_AXIS
1799          * @return the weight
1800          */
1801         public int getResizeWeight(int axis) {
1802             if (view != null) {
1803                 return view.getResizeWeight(axis);
1804             }
1805             return 0;
1806         }


< prev index next >