Example usage for javax.swing JTextPane getInsets

List of usage examples for javax.swing JTextPane getInsets

Introduction

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

Prototype

@BeanProperty(expert = true)
public Insets getInsets() 

Source Link

Document

If a border has been set on this component, returns the border's insets; otherwise calls super.getInsets.

Usage

From source file:MainClass.java

protected Rectangle getVisibleEditorRect(JTextPane ta) {
    Rectangle alloc = ta.getBounds();
    if ((alloc.width > 0) && (alloc.height > 0)) {
        alloc.x = alloc.y = 0;/*from w  ww  . j a v  a  2  s . c  o m*/
        Insets insets = ta.getInsets();
        alloc.x += insets.left;
        alloc.y += insets.top;
        alloc.width -= insets.left + insets.right;
        alloc.height -= insets.top + insets.bottom;
        return alloc;
    }
    return null;
}