Example #1
0
        public virtual void Redraw()
        {
            string text = editorPane.GetText();

            taggedContents   = null;
            untaggedContents = null;
            if (!editorPane.GetContentType().Equals("text/html"))
            {
                editorPane.SetContentType("text/rtf");
                IDocument doc = editorPane.GetDocument();
                try
                {
                    doc.InsertString(0, text, defaultAttrSet);
                }
                catch (Exception e)
                {
                    throw new Exception(e);
                }
                editorPane.Revalidate();
                editorPane.Repaint();
                editorPane.SetEditable(true);
                htmlContents = null;
            }
            else
            {
                editorPane.SetEditable(false);
                htmlContents = editorPane.GetText();
            }
            saveUntagged.SetEnabled(false);
            saveTaggedAs.SetEnabled(false);
        }
Example #2
0
        private void OpenURL(string url)
        {
            try
            {
                editorPane.SetPage(url);
            }
            catch (Exception e)
            {
                log.Info("Error loading |" + url + '|');
                log.Warn(e);
                DisplayError("Error Loading URL " + url, "Message: " + e);
                return;
            }
            loadedFile = null;
            string text = editorPane.GetText();

            taggedContents = null;
            if (!editorPane.GetContentType().Equals("text/html"))
            {
                editorPane.SetContentType("text/rtf");
                IDocument doc = editorPane.GetDocument();
                try
                {
                    doc.InsertString(0, text, defaultAttrSet);
                }
                catch (Exception e)
                {
                    throw new Exception(e);
                }
                editorPane.Revalidate();
                editorPane.Repaint();
                editorPane.SetEditable(true);
                htmlContents = null;
            }
            else
            {
                editorPane.SetEditable(false);
                htmlContents = editorPane.GetText();
            }
            saveUntagged.SetEnabled(false);
            saveTaggedAs.SetEnabled(false);
        }
Example #3
0
        //  private String initText = "In";
        private void BuildContentPanel()
        {
            editorPane = new JEditorPane();
            editorPane.SetContentType("text/rtf");
            editorPane.AddKeyListener(new NERGUI.InputListener(this));
            //    defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes();
            StyleConstants.SetFontFamily(defaultAttrSet, "Lucinda Sans");
            IDocument doc = new DefaultStyledDocument();

            editorPane.SetDocument(doc);
            try
            {
                doc.InsertString(0, initText, defaultAttrSet);
            }
            catch (Exception ex)
            {
                throw new Exception(ex);
            }
            JScrollPane scrollPane = new JScrollPane(editorPane);

            frame.GetContentPane().Add(scrollPane, BorderLayout.Center);
            editorPane.SetEditable(true);
        }