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

Print this page


   1 /*
   2  * Copyright (c) 1997, 2010, 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


1182         }
1183     }
1184 
1185     /**
1186      * Fetches the EditorKit for the UI.
1187      *
1188      * @param tc the text component for which this UI is installed
1189      * @return the editor capabilities
1190      * @see TextUI#getEditorKit
1191      */
1192     public EditorKit getEditorKit(JTextComponent tc) {
1193         return defaultKit;
1194     }
1195 
1196     /**
1197      * Fetches a View with the allocation of the associated
1198      * text component (i.e. the root of the hierarchy) that
1199      * can be traversed to determine how the model is being
1200      * represented spatially.
1201      * <p>
1202      * <font color=red><b>NOTE:</b>The View hierarchy can
1203      * be traversed from the root view, and other things
1204      * can be done as well.  Things done in this way cannot
1205      * be protected like simple method calls through the TextUI.
1206      * Therefore, proper operation in the presence of concurrency
1207      * must be arranged by any logic that calls this method!
1208      * </font>
1209      *
1210      * @param tc the text component for which this UI is installed
1211      * @return the view
1212      * @see TextUI#getRootView
1213      */
1214     public View getRootView(JTextComponent tc) {
1215         return rootView;
1216     }
1217 
1218 
1219     /**
1220      * Returns the string to be used as the tooltip at the passed in location.
1221      * This forwards the method onto the root View.
1222      *


   1 /*
   2  * Copyright (c) 1997, 2013, 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


1182         }
1183     }
1184 
1185     /**
1186      * Fetches the EditorKit for the UI.
1187      *
1188      * @param tc the text component for which this UI is installed
1189      * @return the editor capabilities
1190      * @see TextUI#getEditorKit
1191      */
1192     public EditorKit getEditorKit(JTextComponent tc) {
1193         return defaultKit;
1194     }
1195 
1196     /**
1197      * Fetches a View with the allocation of the associated
1198      * text component (i.e. the root of the hierarchy) that
1199      * can be traversed to determine how the model is being
1200      * represented spatially.
1201      * <p>
1202      * <font style="color: red;"><b>NOTE:</b>The View hierarchy can
1203      * be traversed from the root view, and other things
1204      * can be done as well.  Things done in this way cannot
1205      * be protected like simple method calls through the TextUI.
1206      * Therefore, proper operation in the presence of concurrency
1207      * must be arranged by any logic that calls this method!
1208      * </font>
1209      *
1210      * @param tc the text component for which this UI is installed
1211      * @return the view
1212      * @see TextUI#getRootView
1213      */
1214     public View getRootView(JTextComponent tc) {
1215         return rootView;
1216     }
1217 
1218 
1219     /**
1220      * Returns the string to be used as the tooltip at the passed in location.
1221      * This forwards the method onto the root View.
1222      *