Java JScrollPane getScrollPaneViewportSize(JScrollPane panel)

Here you can find the source of getScrollPaneViewportSize(JScrollPane panel)

Description

get Scroll Pane Viewport Size

License

Open Source License

Declaration

public static final Rectangle getScrollPaneViewportSize(JScrollPane panel) 

Method Source Code

//package com.java2s;

import java.awt.Rectangle;

import javax.swing.JScrollBar;
import javax.swing.JScrollPane;

public class Main {
    public static final Rectangle getScrollPaneViewportSize(JScrollPane panel) {
        Rectangle viewRect = panel.getViewportBorderBounds();
        JScrollBar vbar = panel.getVerticalScrollBar();
        if (vbar.isVisible()) {
            viewRect.width = viewRect.width + vbar.getWidth();
        }//w  ww .ja va  2s . c  o  m
        JScrollBar hbar = panel.getHorizontalScrollBar();
        if (hbar.isVisible()) {
            viewRect.height = viewRect.height + hbar.getHeight();
        }
        return viewRect;
    }
}

Related

  1. getContainingScroll(Component comp)
  2. getMessageScrollPane(String message)
  3. getNoScrollPaletteWindow(Component gui, String windowName, ComponentListener cl)
  4. getScrollableMessage(String msg)
  5. getScrollBarWidth(BasicComboPopup popup, JScrollPane scrollPane)
  6. hasParentScrollPane(JComponent component)
  7. initScrollPane(JScrollPane scrollPane)
  8. isHorizontalScrollBarHiddenAlways(JScrollPane pane)
  9. isScrolledToBottom(final JScrollPane scrollPane)