本文整理匯總了Java中javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS屬性的典型用法代碼示例。如果您正苦於以下問題:Java ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS屬性的具體用法?Java ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS怎麽用?Java ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.swing.ScrollPaneConstants
的用法示例。
在下文中一共展示了ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getMinimumSize
@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;
}
示例2: ThemeReaderCrashTest
ThemeReaderCrashTest() {
JPanel panel = new JPanel();
JScrollPane pane =
new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
panel.setSize(300, 200);
panel.add(pane);
}