Example usage for javax.swing JTextPane setVerifyInputWhenFocusTarget

List of usage examples for javax.swing JTextPane setVerifyInputWhenFocusTarget

Introduction

In this page you can find the example usage for javax.swing JTextPane setVerifyInputWhenFocusTarget.

Prototype

@BeanProperty(description = "Whether the Component verifies input before accepting focus.")
public void setVerifyInputWhenFocusTarget(boolean verifyInputWhenFocusTarget) 

Source Link

Document

Sets the value to indicate whether input verifier for the current focus owner will be called before this component requests focus.

Usage

From source file:Main.java

/**
 * Creates a new <code>JTextPane</code> object with the given properties.
 *
 * @param text The text which will appear in the text pane
 * @param backgroundColor The background color
 * @return A <code>JTextPane</code> object
 *///  ww  w . ja v a2 s .c om
public static JTextPane createJTextPane(String text, Color backgroundColor) {
    JTextPane jTextPane = new JTextPane();
    jTextPane.setBorder(null);
    jTextPane.setEditable(false);
    jTextPane.setBackground(backgroundColor);
    jTextPane.setFont(new Font("Times New Roman", Font.PLAIN, 14));
    if (text != null) {
        jTextPane.setText(text);
    }
    jTextPane.setVerifyInputWhenFocusTarget(false);
    jTextPane.setAutoscrolls(false);
    return jTextPane;
}