Examples of DefaultStyledDocument


Examples of javax.swing.text.DefaultStyledDocument

        boolean oldVisible = dialog.isVisible();
        JScrollBar verticalScrollBar = scrollPane.getVerticalScrollBar();
        int oldPosition = verticalScrollBar.getValue();
        int oldCaretPosition = textPane.getCaretPosition();

        StyledDocument document = new DefaultStyledDocument();
        SimpleAttributeSet attributeSet = new SimpleAttributeSet();
        StyleConstants.setBold(attributeSet, true);
        StyleConstants.setAlignment(attributeSet, StyleConstants.ALIGN_JUSTIFIED);
        try {
            document.insertString(document.getLength(), text, attributeSet);
        }
        catch (BadLocationException e) {
            // Normally cannot happen.
            textPane.setText(text);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.