/** * Checks whether the specified scroll pane supports auto scroll. * * @param scrollPane * Scroll pane component. * @return <code>true</code> if the specified scroll pane supports auto * scroll, <code>false</code> otherwise. */ public static boolean hasAutoScroll(JScrollPane scrollPane) { Object compProperty = scrollPane .getClientProperty(LafWidget.AUTO_SCROLL); if (Boolean.TRUE.equals(compProperty)) return true; if (Boolean.FALSE.equals(compProperty)) return false; return (Boolean.TRUE.equals(UIManager.get(LafWidget.AUTO_SCROLL))); }
protected void initScrollPane(JScrollPane scrollPane) { Boolean onlyVerticalScrollable = (Boolean) scrollPane.getClientProperty("onlyVerticalScrollable"); if (onlyVerticalScrollable != null && onlyVerticalScrollable) { scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); final JViewport viewport = scrollPane.getViewport(); viewport.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { Dimension newDimension = new Dimension(viewport.getExtentSize().width, viewport.getViewSize().height); viewport.setViewSize(newDimension); } }); } }
/** * Returns the scroll bar buttons kind of the specified scroll bar. * * @param scrollBar * Scroll bar. * @return The scroll bar buttons kind of the specified scroll bar. * @see SubstanceLookAndFeel#SCROLL_PANE_BUTTONS_POLICY */ public static ScrollPaneButtonPolicyKind getScrollPaneButtonsPolicyKind( JScrollBar scrollBar) { Component parent = scrollBar.getParent(); if (parent instanceof JScrollPane) { Object jspKind = ((JScrollPane) parent) .getClientProperty(SubstanceLookAndFeel.SCROLL_PANE_BUTTONS_POLICY); if (jspKind instanceof ScrollPaneButtonPolicyKind) return (ScrollPaneButtonPolicyKind) jspKind; } Object globalJspKind = UIManager .get(SubstanceLookAndFeel.SCROLL_PANE_BUTTONS_POLICY); if (globalJspKind instanceof ScrollPaneButtonPolicyKind) return (ScrollPaneButtonPolicyKind) globalJspKind; return ScrollPaneButtonPolicyKind.OPPOSITE; }
/** * Returns the scroll bar buttons kind of the specified scroll bar. * * @param scrollBar * Scroll bar. * @return The scroll bar buttons kind of the specified scroll bar. * @see SubstanceLookAndFeel#SCROLL_PANE_BUTTONS_POLICY */ public static ScrollPaneButtonPolicyKind getScrollPaneButtonsPolicyKind( JScrollBar scrollBar) { Component parent = scrollBar.getParent(); if (parent instanceof JScrollPane) { Object jspKind = ((JScrollPane) parent) .getClientProperty(SubstanceLookAndFeel.SCROLL_PANE_BUTTONS_POLICY); if (jspKind instanceof ScrollPaneButtonPolicyKind) return (ScrollPaneButtonPolicyKind) jspKind; } Object globalJspKind = UIManager .get(SubstanceLookAndFeel.SCROLL_PANE_BUTTONS_POLICY); if (globalJspKind instanceof ScrollPaneButtonPolicyKind) return (ScrollPaneButtonPolicyKind) globalJspKind; return ScrollPaneButtonPolicyKind.OPPOSITE; }
static boolean isDark(Component c) { Container parent = c.getParent(); if (parent instanceof JScrollPane) { JScrollPane pane = (JScrollPane)parent; Object property = pane.getClientProperty(BRIGHTNESS_FROM_VIEW); if (property instanceof Boolean && (Boolean)property) { Color color = JBScrollPane.getViewBackground(pane); if (color != null) return ColorUtil.isDark(color); } } return UIUtil.isUnderDarcula(); } }
JBInsets.removeFrom(bounds, pane.getInsets()); Object property = pane.getClientProperty(Flip.class); Flip flip = property instanceof Flip ? (Flip)property : Flip.NONE; boolean hsbOnTop = flip == Flip.BOTH || flip == Flip.VERTICAL;