Java JTextPane setDefaultTextPaneProperties(JTextPane textPane)

Here you can find the source of setDefaultTextPaneProperties(JTextPane textPane)

Description

set Default Text Pane Properties

License

BSD License

Declaration

public static void setDefaultTextPaneProperties(JTextPane textPane) 

Method Source Code


//package com.java2s;
/*//from ww  w.ja  va2 s  . c o m
    
[The "BSD licence"]
Copyright (c) 2005 Jean Bovet
All rights reserved.
    
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
    
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
    
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    
*/

import javax.swing.*;
import javax.swing.text.*;

public class Main {
    public static void setDefaultTextPaneProperties(JTextPane textPane) {
        // Set by default the end of line property in order to always use the Unix style
        textPane.getDocument().putProperty(DefaultEditorKit.EndOfLineStringProperty, "\n");
    }
}

Related

  1. insertStyledString(JTextPane textPane, String text, SimpleAttributeSet attrSet, Color background, Color foreground, String fontFamily, int fontSize, boolean bold, boolean italic, boolean underline, boolean strikeThrough, Boolean superscript)
  2. isSelectionBold(JTextPane textPane)
  3. overrideStyle(String styleName, JTextPane textPane, Style newStyle)
  4. saveFile(JTextPane txt)
  5. scrollTo(JTextPane textPane, int position)
  6. setJTextPaneFont(JTextPane jtp, Font font, Color c)
  7. setSelectionFontSize(JTextPane textPane, int fontSize)
  8. setSelectionForeground(JTextPane textPane, Color color)
  9. setStyle(JTextPane textPane, int start, int length, String name)