Package javax.swing.text

Examples of javax.swing.text.EditorKit


{

    public pamHelper(String resourceStr, String titleStr)
    {
        JEditorPane jep = new JEditorPane();
        EditorKit ek = new HTMLEditorKit();
        ek.install(jep);
        jep.setEditorKit(ek);
        try
        {
            jep.read(getClass().getResourceAsStream(resourceStr), "");
        }
View Full Code Here


     *
     * @param type the content type
     * @return the editor kit, or null if one cannot be created
     */
    public EditorKit createEditorKitForContentType(String type) {
        EditorKit k = null;
        if (kitRegistry == null) {
            // nothing has been loaded yet.
            kitRegistry = new Hashtable();
        } else {
            k = (EditorKit) kitRegistry.get(type);
        }
        if (k == null) {
            // try to dynamically load the support
      HelpSet hs = model.getHelpSet();
            String classname =
    (String) hs.getKeyData(HelpSet.kitTypeRegistry,
               type);
      // I don't know of a class for this type
      if (classname == null) {
    return null;
      }
      ClassLoader loader =
    (ClassLoader) hs.getKeyData(HelpSet.kitLoaderRegistry,
              type);
      if (loader == null) {
    loader = hs.getLoader();
      }
            try {
    Class c;
    if (loader != null) {
        c = loader.loadClass(classname);
    } else {
        c = Class.forName(classname);
    }
                k = (EditorKit) c.newInstance();
                kitRegistry.put(type, k);
            } catch (Throwable e) {
                e.printStackTrace();
                k = null;
            }
        }

        // create a copy of the prototype or null if there
        // is no prototype.
        if (k != null) {
            return (EditorKit) k.clone();
        } else {
      // null, check the JEditorPane registry
      k = JEditorPane.createEditorKitForContentType(type);
  }
        return k;
View Full Code Here

    public WatchPanel(String expression) {
        this.expression = expression;
    }
   
    public static void setupContext(JEditorPane editorPane) {
        EditorKit kit = CloneableEditorSupport.getEditorKit("text/x-scala");
        editorPane.setEditorKit(kit);
        DebuggerEngine en = DebuggerManager.getDebuggerManager ().getCurrentEngine();
        JPDADebugger d = en.lookupFirst(null, JPDADebugger.class);
        CallStackFrame csf = d.getCurrentCallStackFrame();
        if (csf != null) {
View Full Code Here

    new LineNumberArea(this);

    LineHighlighter.install(this);

    EditorKit editorKit = new StyledEditorKit() {
      @Override
      public Document createDefaultDocument() {
        return document;
      }
    };
View Full Code Here

        }
        return editorKit;
    }

    public EditorKit getEditorKitForContentType(final String type) {
        EditorKit kit = localContentTypes.get(type);

        if (kit == null) {
            kit = createEditorKitForContentType(type);

            if (kit == null) {
View Full Code Here

            throw new NullPointerException(Messages.getString("swing.03","Content type")); //$NON-NLS-1$ //$NON-NLS-2$
        }
        contentType = (contentTypes.containsKey(type) ? type : PLAIN_CONTENT_TYPE);

        if (changeEditorKit(contentType)) {
            EditorKit kit = getEditorKitForContentType(contentType);
            updateEditorKit((kit != null) ? kit : new PlainEditorKit());
            updateDocument(editorKit);
        }
    }
View Full Code Here

    private void updateEditorKit(final EditorKit kit) {
        if (editorKit != null) {
            editorKit.deinstall(this);
        }
        EditorKit oldEditorKit = editorKit;
        if (kit != null) {
            kit.install(this);
        }
        editorKit = kit;
        firePropertyChange("editorKit", oldEditorKit, kit);
View Full Code Here

        }
        return editorKit;
    }

    public EditorKit getEditorKitForContentType(final String type) {
        EditorKit kit = localContentTypes.get(type);

        if (kit == null) {
            kit = createEditorKitForContentType(type);

            if (kit == null) {
View Full Code Here

        if (!contentTypes.containsKey(type)) {
            type = PLAIN_CONTENT_TYPE;
        }

        if (changeEditorKit(type)) {
            EditorKit kit = getEditorKitForContentType(type);
            updateEditorKit((kit != null) ? kit : new PlainEditorKit());
            updateDocument(editorKit);
        }
    }
View Full Code Here

    private void updateEditorKit(final EditorKit kit) {
        if (editorKit != null) {
            editorKit.deinstall(this);
        }
        EditorKit oldEditorKit = editorKit;
        if (kit != null) {
            kit.install(this);
        }
        editorKit = kit;
        firePropertyChange("editorKit", oldEditorKit, kit);
View Full Code Here

TOP

Related Classes of javax.swing.text.EditorKit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.