< prev index next >

src/java.desktop/share/classes/javax/swing/text/GlyphView.java

Print this page




 253         return expander;
 254     }
 255 
 256     /**
 257      * Check to see that a glyph painter exists.  If a painter
 258      * doesn't exist, a default glyph painter will be installed.
 259      */
 260     protected void checkPainter() {
 261         if (painter == null) {
 262             if (defaultPainter == null) {
 263                 // the classname should probably come from a property file.
 264                 String classname = "javax.swing.text.GlyphPainter1";
 265                 try {
 266                     Class<?> c;
 267                     ClassLoader loader = getClass().getClassLoader();
 268                     if (loader != null) {
 269                         c = loader.loadClass(classname);
 270                     } else {
 271                         c = Class.forName(classname);
 272                     }

 273                     Object o = c.newInstance();
 274                     if (o instanceof GlyphPainter) {
 275                         defaultPainter = (GlyphPainter) o;
 276                     }
 277                 } catch (Throwable e) {
 278                     throw new StateInvariantError("GlyphView: Can't load glyph painter: "
 279                                                   + classname);
 280                 }
 281             }
 282             setGlyphPainter(defaultPainter.getPainter(this, getStartOffset(),
 283                                                       getEndOffset()));
 284         }
 285     }
 286 
 287     // --- TabableView methods --------------------------------------
 288 
 289     /**
 290      * Determines the desired span when using the given
 291      * tab expansion implementation.
 292      *




 253         return expander;
 254     }
 255 
 256     /**
 257      * Check to see that a glyph painter exists.  If a painter
 258      * doesn't exist, a default glyph painter will be installed.
 259      */
 260     protected void checkPainter() {
 261         if (painter == null) {
 262             if (defaultPainter == null) {
 263                 // the classname should probably come from a property file.
 264                 String classname = "javax.swing.text.GlyphPainter1";
 265                 try {
 266                     Class<?> c;
 267                     ClassLoader loader = getClass().getClassLoader();
 268                     if (loader != null) {
 269                         c = loader.loadClass(classname);
 270                     } else {
 271                         c = Class.forName(classname);
 272                     }
 273                     @SuppressWarnings("deprecation")
 274                     Object o = c.newInstance();
 275                     if (o instanceof GlyphPainter) {
 276                         defaultPainter = (GlyphPainter) o;
 277                     }
 278                 } catch (Throwable e) {
 279                     throw new StateInvariantError("GlyphView: Can't load glyph painter: "
 280                                                   + classname);
 281                 }
 282             }
 283             setGlyphPainter(defaultPainter.getPainter(this, getStartOffset(),
 284                                                       getEndOffset()));
 285         }
 286     }
 287 
 288     // --- TabableView methods --------------------------------------
 289 
 290     /**
 291      * Determines the desired span when using the given
 292      * tab expansion implementation.
 293      *


< prev index next >