Java Code Examples for javax.swing.JScrollBar#getMinimumSize()

The following examples show how to use javax.swing.JScrollBar#getMinimumSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LWTextAreaPeer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Dimension getMinimumSize(final int rows, final int columns) {
    final Dimension size = super.getMinimumSize(rows, columns);
    synchronized (getDelegateLock()) {
        // JScrollPane insets
        final Insets pi = getDelegate().getInsets();
        size.width += pi.left + pi.right;
        size.height += pi.top + pi.bottom;
        // Take scrollbars into account.
        final int vsbPolicy = getDelegate().getVerticalScrollBarPolicy();
        if (vsbPolicy == ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) {
            final JScrollBar vbar = getDelegate().getVerticalScrollBar();
            size.width += vbar != null ? vbar.getMinimumSize().width : 0;
        }
        final int hsbPolicy = getDelegate().getHorizontalScrollBarPolicy();
        if (hsbPolicy == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) {
            final JScrollBar hbar = getDelegate().getHorizontalScrollBar();
            size.height += hbar != null ? hbar.getMinimumSize().height : 0;
        }
    }
    return size;
}
 
Example 2
Source File: LWTextAreaPeer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Dimension getMinimumSize(final int rows, final int columns) {
    final Dimension size = super.getMinimumSize(rows, columns);
    synchronized (getDelegateLock()) {
        // JScrollPane insets
        final Insets pi = getDelegate().getInsets();
        size.width += pi.left + pi.right;
        size.height += pi.top + pi.bottom;
        // Take scrollbars into account.
        final int vsbPolicy = getDelegate().getVerticalScrollBarPolicy();
        if (vsbPolicy == ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) {
            final JScrollBar vbar = getDelegate().getVerticalScrollBar();
            size.width += vbar != null ? vbar.getMinimumSize().width : 0;
        }
        final int hsbPolicy = getDelegate().getHorizontalScrollBarPolicy();
        if (hsbPolicy == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) {
            final JScrollBar hbar = getDelegate().getHorizontalScrollBar();
            size.height += hbar != null ? hbar.getMinimumSize().height : 0;
        }
    }
    return size;
}
 
Example 3
Source File: LWTextAreaPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Dimension getMinimumSize(final int rows, final int columns) {
    final Dimension size = super.getMinimumSize(rows, columns);
    synchronized (getDelegateLock()) {
        // JScrollPane insets
        final Insets pi = getDelegate().getInsets();
        size.width += pi.left + pi.right;
        size.height += pi.top + pi.bottom;
        // Take scrollbars into account.
        final int vsbPolicy = getDelegate().getVerticalScrollBarPolicy();
        if (vsbPolicy == ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) {
            final JScrollBar vbar = getDelegate().getVerticalScrollBar();
            size.width += vbar != null ? vbar.getMinimumSize().width : 0;
        }
        final int hsbPolicy = getDelegate().getHorizontalScrollBarPolicy();
        if (hsbPolicy == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) {
            final JScrollBar hbar = getDelegate().getHorizontalScrollBar();
            size.height += hbar != null ? hbar.getMinimumSize().height : 0;
        }
    }
    return size;
}
 
Example 4
Source File: LWTextAreaPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Dimension getMinimumSize(final int rows, final int columns) {
    final Dimension size = super.getMinimumSize(rows, columns);
    synchronized (getDelegateLock()) {
        // JScrollPane insets
        final Insets pi = getDelegate().getInsets();
        size.width += pi.left + pi.right;
        size.height += pi.top + pi.bottom;
        // Take scrollbars into account.
        final int vsbPolicy = getDelegate().getVerticalScrollBarPolicy();
        if (vsbPolicy == ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) {
            final JScrollBar vbar = getDelegate().getVerticalScrollBar();
            size.width += vbar != null ? vbar.getMinimumSize().width : 0;
        }
        final int hsbPolicy = getDelegate().getHorizontalScrollBarPolicy();
        if (hsbPolicy == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) {
            final JScrollBar hbar = getDelegate().getHorizontalScrollBar();
            size.height += hbar != null ? hbar.getMinimumSize().height : 0;
        }
    }
    return size;
}
 
Example 5
Source File: LWTextAreaPeer.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Dimension getMinimumSize(final int rows, final int columns) {
    final Dimension size = super.getMinimumSize(rows, columns);
    synchronized (getDelegateLock()) {
        // JScrollPane insets
        final Insets pi = getDelegate().getInsets();
        size.width += pi.left + pi.right;
        size.height += pi.top + pi.bottom;
        // Take scrollbars into account.
        final int vsbPolicy = getDelegate().getVerticalScrollBarPolicy();
        if (vsbPolicy == ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) {
            final JScrollBar vbar = getDelegate().getVerticalScrollBar();
            size.width += vbar != null ? vbar.getMinimumSize().width : 0;
        }
        final int hsbPolicy = getDelegate().getHorizontalScrollBarPolicy();
        if (hsbPolicy == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) {
            final JScrollBar hbar = getDelegate().getHorizontalScrollBar();
            size.height += hbar != null ? hbar.getMinimumSize().height : 0;
        }
    }
    return size;
}
 
Example 6
Source File: LWTextAreaPeer.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Dimension getMinimumSize(final int rows, final int columns) {
    final Dimension size = super.getMinimumSize(rows, columns);
    synchronized (getDelegateLock()) {
        // JScrollPane insets
        final Insets pi = getDelegate().getInsets();
        size.width += pi.left + pi.right;
        size.height += pi.top + pi.bottom;
        // Take scrollbars into account.
        final int vsbPolicy = getDelegate().getVerticalScrollBarPolicy();
        if (vsbPolicy == ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) {
            final JScrollBar vbar = getDelegate().getVerticalScrollBar();
            size.width += vbar != null ? vbar.getMinimumSize().width : 0;
        }
        final int hsbPolicy = getDelegate().getHorizontalScrollBarPolicy();
        if (hsbPolicy == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) {
            final JScrollBar hbar = getDelegate().getHorizontalScrollBar();
            size.height += hbar != null ? hbar.getMinimumSize().height : 0;
        }
    }
    return size;
}
 
Example 7
Source File: LWTextAreaPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Dimension getMinimumSize(final int rows, final int columns) {
    final Dimension size = super.getMinimumSize(rows, columns);
    synchronized (getDelegateLock()) {
        // JScrollPane insets
        final Insets pi = getDelegate().getInsets();
        size.width += pi.left + pi.right;
        size.height += pi.top + pi.bottom;
        // Take scrollbars into account.
        final int vsbPolicy = getDelegate().getVerticalScrollBarPolicy();
        if (vsbPolicy == ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) {
            final JScrollBar vbar = getDelegate().getVerticalScrollBar();
            size.width += vbar != null ? vbar.getMinimumSize().width : 0;
        }
        final int hsbPolicy = getDelegate().getHorizontalScrollBarPolicy();
        if (hsbPolicy == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) {
            final JScrollBar hbar = getDelegate().getHorizontalScrollBar();
            size.height += hbar != null ? hbar.getMinimumSize().height : 0;
        }
    }
    return size;
}
 
Example 8
Source File: LWTextAreaPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Dimension getMinimumSize(final int rows, final int columns) {
    final Dimension size = super.getMinimumSize(rows, columns);
    synchronized (getDelegateLock()) {
        // JScrollPane insets
        final Insets pi = getDelegate().getInsets();
        size.width += pi.left + pi.right;
        size.height += pi.top + pi.bottom;
        // Take scrollbars into account.
        final int vsbPolicy = getDelegate().getVerticalScrollBarPolicy();
        if (vsbPolicy == ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) {
            final JScrollBar vbar = getDelegate().getVerticalScrollBar();
            size.width += vbar != null ? vbar.getMinimumSize().width : 0;
        }
        final int hsbPolicy = getDelegate().getHorizontalScrollBarPolicy();
        if (hsbPolicy == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) {
            final JScrollBar hbar = getDelegate().getHorizontalScrollBar();
            size.height += hbar != null ? hbar.getMinimumSize().height : 0;
        }
    }
    return size;
}
 
Example 9
Source File: XTextAreaPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.peer.TextAreaPeer
 */
@Override
public Dimension getMinimumSize(int rows, int cols) {
    /*    Dimension d = null;
          if (jtext != null) {
          d = jtext.getMinimumSize(rows,cols);
          }
          return d;
    */

    int vsbwidth=0;
    int hsbheight=0;

    JScrollBar vsb = textPane.getVerticalScrollBar();
    if (vsb != null) {
        vsbwidth = vsb.getMinimumSize().width;
    }

    JScrollBar hsb = textPane.getHorizontalScrollBar();
    if (hsb != null) {
        hsbheight = hsb.getMinimumSize().height;
    }

    Font f = jtext.getFont();
    FontMetrics fm = jtext.getFontMetrics(f);

    return new Dimension(fm.charWidth('0') * cols + /*2*XMARGIN +*/ vsbwidth,
                         fm.getHeight() * rows + /*2*YMARGIN +*/ hsbheight);
}
 
Example 10
Source File: XTextAreaPeer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.peer.TextAreaPeer
 */
@Override
public Dimension getMinimumSize(int rows, int cols) {
    /*    Dimension d = null;
          if (jtext != null) {
          d = jtext.getMinimumSize(rows,cols);
          }
          return d;
    */

    int vsbwidth=0;
    int hsbheight=0;

    JScrollBar vsb = textPane.getVerticalScrollBar();
    if (vsb != null) {
        vsbwidth = vsb.getMinimumSize().width;
    }

    JScrollBar hsb = textPane.getHorizontalScrollBar();
    if (hsb != null) {
        hsbheight = hsb.getMinimumSize().height;
    }

    Font f = jtext.getFont();
    FontMetrics fm = jtext.getFontMetrics(f);

    return new Dimension(fm.charWidth('0') * cols + /*2*XMARGIN +*/ vsbwidth,
                         fm.getHeight() * rows + /*2*YMARGIN +*/ hsbheight);
}
 
Example 11
Source File: XTextAreaPeer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.peer.TextAreaPeer
 */
@Override
public Dimension getMinimumSize(int rows, int cols) {
    /*    Dimension d = null;
          if (jtext != null) {
          d = jtext.getMinimumSize(rows,cols);
          }
          return d;
    */

    int vsbwidth=0;
    int hsbheight=0;

    JScrollBar vsb = textPane.getVerticalScrollBar();
    if (vsb != null) {
        vsbwidth = vsb.getMinimumSize().width;
    }

    JScrollBar hsb = textPane.getHorizontalScrollBar();
    if (hsb != null) {
        hsbheight = hsb.getMinimumSize().height;
    }

    Font f = jtext.getFont();
    FontMetrics fm = jtext.getFontMetrics(f);

    return new Dimension(fm.charWidth('0') * cols + /*2*XMARGIN +*/ vsbwidth,
                         fm.getHeight() * rows + /*2*YMARGIN +*/ hsbheight);
}
 
Example 12
Source File: XTextAreaPeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.peer.TextAreaPeer
 */
@Override
public Dimension getMinimumSize(int rows, int cols) {
    /*    Dimension d = null;
          if (jtext != null) {
          d = jtext.getMinimumSize(rows,cols);
          }
          return d;
    */

    int vsbwidth=0;
    int hsbheight=0;

    JScrollBar vsb = textPane.getVerticalScrollBar();
    if (vsb != null) {
        vsbwidth = vsb.getMinimumSize().width;
    }

    JScrollBar hsb = textPane.getHorizontalScrollBar();
    if (hsb != null) {
        hsbheight = hsb.getMinimumSize().height;
    }

    Font f = jtext.getFont();
    FontMetrics fm = jtext.getFontMetrics(f);

    return new Dimension(fm.charWidth('0') * cols + /*2*XMARGIN +*/ vsbwidth,
                         fm.getHeight() * rows + /*2*YMARGIN +*/ hsbheight);
}
 
Example 13
Source File: XTextAreaPeer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.peer.TextAreaPeer
 */
@Override
public Dimension getMinimumSize(int rows, int cols) {
    /*    Dimension d = null;
          if (jtext != null) {
          d = jtext.getMinimumSize(rows,cols);
          }
          return d;
    */

    int vsbwidth=0;
    int hsbheight=0;

    JScrollBar vsb = textPane.getVerticalScrollBar();
    if (vsb != null) {
        vsbwidth = vsb.getMinimumSize().width;
    }

    JScrollBar hsb = textPane.getHorizontalScrollBar();
    if (hsb != null) {
        hsbheight = hsb.getMinimumSize().height;
    }

    Font f = jtext.getFont();
    FontMetrics fm = jtext.getFontMetrics(f);

    return new Dimension(fm.charWidth('0') * cols + /*2*XMARGIN +*/ vsbwidth,
                         fm.getHeight() * rows + /*2*YMARGIN +*/ hsbheight);
}
 
Example 14
Source File: XTextAreaPeer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.peer.TextAreaPeer
 */
@Override
public Dimension getMinimumSize(int rows, int cols) {
    /*    Dimension d = null;
          if (jtext != null) {
          d = jtext.getMinimumSize(rows,cols);
          }
          return d;
    */

    int vsbwidth=0;
    int hsbheight=0;

    JScrollBar vsb = textPane.getVerticalScrollBar();
    if (vsb != null) {
        vsbwidth = vsb.getMinimumSize().width;
    }

    JScrollBar hsb = textPane.getHorizontalScrollBar();
    if (hsb != null) {
        hsbheight = hsb.getMinimumSize().height;
    }

    Font f = jtext.getFont();
    FontMetrics fm = jtext.getFontMetrics(f);

    return new Dimension(fm.charWidth('0') * cols + /*2*XMARGIN +*/ vsbwidth,
                         fm.getHeight() * rows + /*2*YMARGIN +*/ hsbheight);
}
 
Example 15
Source File: XTextAreaPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.peer.TextAreaPeer
 */
@Override
public Dimension getMinimumSize(int rows, int cols) {
    /*    Dimension d = null;
          if (jtext != null) {
          d = jtext.getMinimumSize(rows,cols);
          }
          return d;
    */

    int vsbwidth=0;
    int hsbheight=0;

    JScrollBar vsb = textPane.getVerticalScrollBar();
    if (vsb != null) {
        vsbwidth = vsb.getMinimumSize().width;
    }

    JScrollBar hsb = textPane.getHorizontalScrollBar();
    if (hsb != null) {
        hsbheight = hsb.getMinimumSize().height;
    }

    Font f = jtext.getFont();
    FontMetrics fm = jtext.getFontMetrics(f);

    return new Dimension(fm.charWidth('0') * cols + /*2*XMARGIN +*/ vsbwidth,
                         fm.getHeight() * rows + /*2*YMARGIN +*/ hsbheight);
}
 
Example 16
Source File: XTextAreaPeer.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.peer.TextAreaPeer
 */
@Override
public Dimension getMinimumSize(int rows, int cols) {
    /*    Dimension d = null;
          if (jtext != null) {
          d = jtext.getMinimumSize(rows,cols);
          }
          return d;
    */

    int vsbwidth=0;
    int hsbheight=0;

    JScrollBar vsb = textPane.getVerticalScrollBar();
    if (vsb != null) {
        vsbwidth = vsb.getMinimumSize().width;
    }

    JScrollBar hsb = textPane.getHorizontalScrollBar();
    if (hsb != null) {
        hsbheight = hsb.getMinimumSize().height;
    }

    Font f = jtext.getFont();
    FontMetrics fm = jtext.getFontMetrics(f);

    return new Dimension(fm.charWidth('0') * cols + /*2*XMARGIN +*/ vsbwidth,
                         fm.getHeight() * rows + /*2*YMARGIN +*/ hsbheight);
}
 
Example 17
Source File: XTextAreaPeer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.peer.TextAreaPeer
 */
@Override
public Dimension getMinimumSize(int rows, int cols) {
    /*    Dimension d = null;
          if (jtext != null) {
          d = jtext.getMinimumSize(rows,cols);
          }
          return d;
    */

    int vsbwidth=0;
    int hsbheight=0;

    JScrollBar vsb = textPane.getVerticalScrollBar();
    if (vsb != null) {
        vsbwidth = vsb.getMinimumSize().width;
    }

    JScrollBar hsb = textPane.getHorizontalScrollBar();
    if (hsb != null) {
        hsbheight = hsb.getMinimumSize().height;
    }

    Font f = jtext.getFont();
    FontMetrics fm = jtext.getFontMetrics(f);

    return new Dimension(fm.charWidth('0') * cols + /*2*XMARGIN +*/ vsbwidth,
                         fm.getHeight() * rows + /*2*YMARGIN +*/ hsbheight);
}
 
Example 18
Source File: XTextAreaPeer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.peer.TextAreaPeer
 */
@Override
public Dimension getMinimumSize(int rows, int cols) {
    /*    Dimension d = null;
          if (jtext != null) {
          d = jtext.getMinimumSize(rows,cols);
          }
          return d;
    */

    int vsbwidth=0;
    int hsbheight=0;

    JScrollBar vsb = textPane.getVerticalScrollBar();
    if (vsb != null) {
        vsbwidth = vsb.getMinimumSize().width;
    }

    JScrollBar hsb = textPane.getHorizontalScrollBar();
    if (hsb != null) {
        hsbheight = hsb.getMinimumSize().height;
    }

    Font f = jtext.getFont();
    FontMetrics fm = jtext.getFontMetrics(f);

    return new Dimension(fm.charWidth('0') * cols + /*2*XMARGIN +*/ vsbwidth,
                         fm.getHeight() * rows + /*2*YMARGIN +*/ hsbheight);
}
 
Example 19
Source File: XTextAreaPeer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.peer.TextAreaPeer
 */
@Override
public Dimension getMinimumSize(int rows, int cols) {
    /*    Dimension d = null;
          if (jtext != null) {
          d = jtext.getMinimumSize(rows,cols);
          }
          return d;
    */

    int vsbwidth=0;
    int hsbheight=0;

    JScrollBar vsb = textPane.getVerticalScrollBar();
    if (vsb != null) {
        vsbwidth = vsb.getMinimumSize().width;
    }

    JScrollBar hsb = textPane.getHorizontalScrollBar();
    if (hsb != null) {
        hsbheight = hsb.getMinimumSize().height;
    }

    Font f = jtext.getFont();
    FontMetrics fm = jtext.getFontMetrics(f);

    return new Dimension(fm.charWidth('0') * cols + /*2*XMARGIN +*/ vsbwidth,
                         fm.getHeight() * rows + /*2*YMARGIN +*/ hsbheight);
}
 
Example 20
Source File: XTextAreaPeer.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.peer.TextAreaPeer
 */
@Override
public Dimension getMinimumSize(int rows, int cols) {
    /*    Dimension d = null;
          if (jtext != null) {
          d = jtext.getMinimumSize(rows,cols);
          }
          return d;
    */

    int vsbwidth=0;
    int hsbheight=0;

    JScrollBar vsb = textPane.getVerticalScrollBar();
    if (vsb != null) {
        vsbwidth = vsb.getMinimumSize().width;
    }

    JScrollBar hsb = textPane.getHorizontalScrollBar();
    if (hsb != null) {
        hsbheight = hsb.getMinimumSize().height;
    }

    Font f = jtext.getFont();
    FontMetrics fm = jtext.getFontMetrics(f);

    return new Dimension(fm.charWidth('0') * cols + /*2*XMARGIN +*/ vsbwidth,
                         fm.getHeight() * rows + /*2*YMARGIN +*/ hsbheight);
}