congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
DefaultStyledDocument.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
javax.swing.text.DefaultStyledDocument
constructor

Best Java code snippets using javax.swing.text.DefaultStyledDocument.<init> (Showing top 20 results out of 378)

origin: stanfordnlp/CoreNLP

private void buildContentPanel() {
 editorPane = new JEditorPane ();
 editorPane.setContentType("text/rtf");
 editorPane.addKeyListener(new InputListener());
 //    defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes();
 StyleConstants.setFontFamily(defaultAttrSet, "Lucida Sans");
 Document doc = new DefaultStyledDocument();
 editorPane.setDocument(doc);
 try {
  doc.insertString(0, initText, defaultAttrSet);
 } catch (Exception ex) {
  throw new RuntimeException(ex);
 }
 JScrollPane scrollPane = new JScrollPane(editorPane);
 frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
 editorPane.setEditable(true);
}
origin: stanfordnlp/CoreNLP

private void buildContentPanel() {
 editorPane = new JEditorPane ();
 editorPane.setContentType("text/rtf");
 editorPane.addKeyListener(new InputListener());
 //    defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes();
 StyleConstants.setFontFamily(defaultAttrSet, "Lucinda Sans");
 Document doc = new DefaultStyledDocument();
 editorPane.setDocument(doc);
 try {
  doc.insertString(0, initText, defaultAttrSet);
 } catch (Exception ex) {
  throw new RuntimeException(ex);
 }
 JScrollPane scrollPane = new JScrollPane(editorPane);
 frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
 editorPane.setEditable(true);
}
origin: stanfordnlp/CoreNLP

private void clearDocument() {
 editorPane.setContentType("text/rtf");
 Document doc = new DefaultStyledDocument();
 editorPane.setDocument(doc);
 //    defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes();
 //    StyleConstants.setFontFamily(defaultAttrSet, "Lucinda Sans Unicode");
 log.info("attr: "+defaultAttrSet);
 try {
  doc.insertString(0, " ", defaultAttrSet);
 } catch (Exception ex) {
  throw new RuntimeException(ex);
 }
 editorPane.setEditable(true);
 editorPane.revalidate();
 editorPane.repaint();
 saveUntagged.setEnabled(false);
 saveTaggedAs.setEnabled(false);
 taggedContents = null;
 htmlContents = null;
 loadedFile = null;
}
origin: stanfordnlp/CoreNLP

public void clearDocument() {
 editorPane.setContentType("text/rtf");
 Document doc = new DefaultStyledDocument();
 editorPane.setDocument(doc);
 //    defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes();
 //    StyleConstants.setFontFamily(defaultAttrSet, "Lucinda Sans Unicode");
 log.info("attr: "+defaultAttrSet);
 try {
  doc.insertString(0, " ", defaultAttrSet);
 } catch (Exception ex) {
  throw new RuntimeException(ex);
 }
 editorPane.setEditable(true);
 editorPane.revalidate();
 editorPane.repaint();
 saveUntagged.setEnabled(false);
 saveTaggedAs.setEnabled(false);
 taggedContents = null;
 untaggedContents = null;
 htmlContents = null;
 loadedFile = null;
}
origin: groovy/groovy-core

DefaultStyledDocument doc = new DefaultStyledDocument();
doc.setDocumentFilter(new GroovyFilter(doc));
textEditor.setDocument(doc);
origin: stackoverflow.com

 DefaultStyledDocument document = new DefaultStyledDocument();
JTextPane textpane = new JTextPane(document);
StyleContext context = new StyleContext();
// build a style
Style style = context.addStyle("test", null);
// set some style properties
StyleConstants.setForeground(style, Color.BLUE);
// add some data to the document
document.insertString(0, "", style);
origin: stackoverflow.com

JTextPane textPane = new JTextPane(new DefaultStyledDocument());
((AbstractDocument) textPane.getDocument()).setDocumentFilter(new HighlightDocumentFilter(textPane));
JFrame frame = new JFrame("Test");
origin: apache/pdfbox

private StyledDocument getDocument(InputStream inputStream, String encoding)
{
  StyledDocument docu = new DefaultStyledDocument();
  if (inputStream != null)
  {
    String data = getStringOfStream(inputStream, encoding);
    try
    {
      docu.insertString(0, data, null);
    }
    catch (BadLocationException e)
    {
      e.printStackTrace();
    }
  }
  return docu;
}
origin: stackoverflow.com

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
StyledDocument doc = new DefaultStyledDocument();
JTextPane textPane = new JTextPane(doc);
textPane.setText("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has "
origin: apache/pdfbox

private StyledDocument getContentStreamDocument(InputStream inputStream)
{
  StyledDocument docu = new DefaultStyledDocument();
  PDFStreamParser parser;
  try
  {
    parser = new PDFStreamParser(IOUtils.toByteArray(inputStream));
    parser.parse();
  }
  catch (IOException e)
  {
    return null;
  }
  for (Object obj : parser.getTokens())
  {
    writeToken(obj, docu);
  }
  return docu;
}
origin: org.swinglabs.swingx/swingx-all

/**
 * {@inheritDoc}
 */
@Override
protected Document createDefaultDocument() {
  return new DefaultStyledDocument();
}
origin: org.codehaus.jtstand/jtstand-desktop

/**
 * {@inheritDoc}
 */
@Override
protected Document createDefaultDocument() {
  return new DefaultStyledDocument();
}
origin: stackoverflow.com

public class MainFrame {
 public MainFrame() {
   myInitComponents();
 }
//delete the myInitComponents() method
 initComponents () {
 //code useful for the DefaultStyledDocument..
 DefaultStyledDocument doc = new DefaultStyledDocument();
  //components
  textModel = new javax.swing.JTextPane(doc);
 }
origin: stackoverflow.com

 JTextPane textPane = new JTextPane(new DefaultStyledDocument() {
  @Override
  public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
    if ((getLength() + str.length()) <= maxNumberOfCharacters) {
      super.insertString(offs, str, a);
    }
    else {
      Toolkit.getDefaultToolkit().beep();
    }
  }
});
origin: zgqq/mah

private StyledDocument createNormalDocument(String text) {
  StyledDocument document = new DefaultStyledDocument();
  try {
    document.insertString(0, text, normalTextStyle);
    return document;
  } catch (BadLocationException e) {
    throw new UiException(e);
  }
}
origin: stackoverflow.com

 DefaultStyledDocument doc = new DefaultStyledDocument();
StyleContext sc = new StyleContext();
Style style = sc.addStyle("strikethru", null);
StyleConstants.setStrikeThrough (style,true);
doc.insertString (0, "Hello ", null);
doc.insertString (6, "strike through ", style);
JTextPane pane = new JTextPane(doc);
origin: org.apache.uima/uimaj-ep-cas-editor-ide

private String convert(InputStream rtfDocumentInputStream) throws IOException {
 RTFEditorKit aRtfEditorkit = new RTFEditorKit();
 StyledDocument styledDoc = new DefaultStyledDocument();
 String textDocument;
 try {
  aRtfEditorkit.read(rtfDocumentInputStream, styledDoc, 0);
  textDocument = styledDoc.getText(0, styledDoc.getLength());
 } catch (BadLocationException e) {
  throw new IOException("Error during parsing");
 }
 return textDocument;
}
origin: zgqq/mah

private StyledDocument createNormalDocument(String text) {
  StyledDocument document = new DefaultStyledDocument();
  try {
    Style style = theme != null ? theme.getNormalTextStyle() : null;
    document.insertString(0, text, style);
    return document;
  } catch (BadLocationException e) {
    throw new UiException(e);
  }
}
origin: antlr/antlrworks

public ATETextPane(ATEPanel textEditor, StyledEditorKit editorKit) {
  super(new DefaultStyledDocument());
  setCaret(new ATECaret());
  setEditorKit(editorKit==null?new ATEEditorKit(textEditor):editorKit);
  this.textEditor = textEditor;
}
origin: ontop/ontop

  public MappingValidationDialog(JTree tree) {

    super();
    DialogUtils.installEscapeCloseOperation(this);
    myself = this;
    doc = new DefaultStyledDocument();
    createStyles();
    createContent();
    this.setModal(true);
//        DialogUtils.centerDialogWRTParent(tree.getParent(), this);
  }

javax.swing.textDefaultStyledDocument<init>

Popular methods of DefaultStyledDocument

  • getLength
  • insertString
  • getText
  • remove
  • setCharacterAttributes
  • addDocumentListener
  • setDocumentFilter
  • addUndoableEditListener
  • createPosition
  • getParagraphElement
  • getCharacterElement
  • setParagraphAttributes
  • getCharacterElement,
  • setParagraphAttributes,
  • getDefaultRootElement,
  • insert,
  • addStyle,
  • fireInsertUpdate,
  • fireRemoveUpdate,
  • getEndPosition,
  • getStyle

Popular in Java

  • Reactive rest calls using spring rest template
  • compareTo (BigDecimal)
  • getSupportFragmentManager (FragmentActivity)
  • putExtra (Intent)
  • Menu (java.awt)
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now