package de.duehl.vocabulary.japanese.other;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.text.BadLocationException;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;

public class BackgroundOfTextPaneTest {

    public static void main(String args[]) throws BadLocationException {
        //GuiTools.setNiceLayoutManager(); // geht nur ohne Nimbus.
        JFrame frame = new JFrame("Demo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container container = frame.getContentPane();
        JTextPane textPane = new JTextPane();
        textPane.setBackground(Color.cyan);
        SimpleAttributeSet attributeSet = new SimpleAttributeSet();
        StyleConstants.setItalic(attributeSet, true);
        StyleConstants.setForeground(attributeSet, Color.blue);
        StyleConstants.setBackground(attributeSet, Color.white);
        textPane.setCharacterAttributes(attributeSet, true);
        textPane.setText("Updated the background color of the text pane.");
        JScrollPane scrollPane = new JScrollPane(textPane);
        container.add(scrollPane, BorderLayout.CENTER);
        frame.setSize(550, 300);
        frame.setVisible(true);
     }

}
