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

The following examples show how to use javax.swing.JScrollBar#getSize() . 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: SeaGlassScrollBarUI.java    From seaglass with Apache License 2.0 6 votes vote down vote up
private void layoutVScrollbarTogether(JScrollBar sb) {
    ScrollbarLayoutValues lv = new ScrollbarLayoutValues();

    Dimension sbSize = sb.getSize();
    Insets sbInsets = sb.getInsets();

    layoutScrollbarTogether(sb, lv, sbSize.height, sbSize.width, sbInsets.top, sbInsets.bottom, sbInsets.left, sbInsets.right,
        decrButton.getPreferredSize().height, getMinimumThumbSize().height, getMaximumThumbSize().height);

    trackRect.setBounds(lv.itemEdge, lv.trackPosition, lv.itemThickness, lv.trackLength);
    decrButton.setBounds(lv.itemEdge, lv.decrButtonPosition, lv.itemThickness, lv.decrButtonLength);
    incrButton.setBounds(lv.itemEdge, lv.incrButtonPosition, lv.itemThickness, lv.incrButtonLength);
    if (lv.thumbLength > 0) {
        setThumbBounds(lv.itemEdge, lv.thumbPosition, lv.itemThickness, lv.thumbLength);
    } else {
        setThumbBounds(0, 0, 0, 0);
    }
}
 
Example 2
Source File: SeaGlassScrollBarUI.java    From seaglass with Apache License 2.0 6 votes vote down vote up
private void layoutHScrollbarTogetherLeftToRight(JScrollBar sb) {
    ScrollbarLayoutValues lv = new ScrollbarLayoutValues();

    Dimension sbSize = sb.getSize();
    Insets sbInsets = sb.getInsets();

    layoutScrollbarTogether(sb, lv, sbSize.width, sbSize.height, sbInsets.left, sbInsets.right, sbInsets.top, sbInsets.bottom,
        decrButton.getPreferredSize().width, getMinimumThumbSize().width, getMaximumThumbSize().width);

    trackRect.setBounds(lv.trackPosition, lv.itemEdge, lv.trackLength, lv.itemThickness);
    decrButton.setBounds(lv.decrButtonPosition, lv.itemEdge, lv.decrButtonLength, lv.itemThickness);
    incrButton.setBounds(lv.incrButtonPosition, lv.itemEdge, lv.incrButtonLength, lv.itemThickness);
    if (lv.thumbLength > 0) {
        setThumbBounds(lv.thumbPosition, lv.itemEdge, lv.thumbLength, lv.itemThickness);
    } else {
        setThumbBounds(0, 0, 0, 0);
    }
}
 
Example 3
Source File: SeaGlassScrollBarUI.java    From seaglass with Apache License 2.0 5 votes vote down vote up
private void layoutHScrollbarTogetherRightToLeft(JScrollBar sb) {
    ScrollbarLayoutValues lv = new ScrollbarLayoutValues();

    Dimension sbSize = sb.getSize();
    Insets sbInsets = sb.getInsets();

    layoutScrollbarTogether(sb, lv, sbSize.width, sbSize.height, sbInsets.left, sbInsets.right, sbInsets.top, sbInsets.bottom,
        decrButton.getPreferredSize().width, getMinimumThumbSize().width, getMaximumThumbSize().width);

    // Flip the positions of the buttons.
    lv.incrButtonPosition = sbInsets.left;
    lv.decrButtonPosition = lv.incrButtonPosition + lv.incrButtonLength;
    // Make the thumb position relative to the old track and flip it,
    // keeping the position at the left.
    lv.thumbPosition = lv.trackPosition + lv.trackLength - lv.thumbPosition - lv.thumbLength;
    // Flip the position of the track.
    lv.trackPosition = lv.decrButtonPosition + lv.decrButtonLength + incrGap;
    // Make the thumb position relative to the scrollbar.
    lv.thumbPosition += lv.trackPosition;

    trackRect.setBounds(lv.trackPosition, lv.itemEdge, lv.trackLength, lv.itemThickness);
    decrButton.setBounds(lv.decrButtonPosition, lv.itemEdge, lv.decrButtonLength, lv.itemThickness);
    incrButton.setBounds(lv.incrButtonPosition, lv.itemEdge, lv.incrButtonLength, lv.itemThickness);
    if (lv.thumbLength > 0) {
        setThumbBounds(lv.thumbPosition, lv.itemEdge, lv.thumbLength, lv.itemThickness);
    } else {
        setThumbBounds(0, 0, 0, 0);
    }
}