public void layoutContainer(Container parent) { super.layoutContainer(parent); Component view = (viewport != null) ? viewport.getView() : null; Dimension viewPrefSize = (view != null) ? view.getPreferredSize() : new Dimension(0,0); Dimension extentSize = (viewport != null) ? viewport.toViewCoordinates(viewport.getSize()) : new Dimension(0,0); boolean viewTracksViewportWidth = (view instanceof Scrollable) && ((Scrollable)view).getScrollableTracksViewportWidth(); boolean hsbNeeded = !viewTracksViewportWidth && viewPrefSize.width > extentSize.width; // enable horizontal scrollbar only if it is needed if (hsb != null) { hsb.setEnabled(hsbNeeded); } // make dependent horizontal scrollbar visible by setting scrollbar policy JScrollPane scrollPane = (JScrollPane)parent; if (scrollPane.getHorizontalScrollBarPolicy() != JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS) { int newPolicy = hsbNeeded ? JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS : JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED; if (newPolicy != dependentScrollPane.getHorizontalScrollBarPolicy()) { dependentScrollPane.setHorizontalScrollBarPolicy(newPolicy); dependentScrollPane.getViewport().invalidate(); } } } }
public void layoutContainer(Container parent) { super.layoutContainer(parent); Component view = (viewport != null) ? viewport.getView() : null; Dimension viewPrefSize = (view != null) ? view.getPreferredSize() : new Dimension(0, 0); Dimension extentSize = (viewport != null) ? viewport.toViewCoordinates(viewport.getSize()) : new Dimension(0, 0); boolean viewTracksViewportWidth = (view instanceof Scrollable) && ((Scrollable) view).getScrollableTracksViewportWidth(); boolean hsbNeeded = !viewTracksViewportWidth && (viewPrefSize.width > extentSize.width); // enable horizontal scrollbar only if it is needed if (hsb != null) { hsb.setEnabled(hsbNeeded); } // make dependent horizontal scrollbar visible by setting scrollbar policy JScrollPane scrollPane = (JScrollPane) parent; if (scrollPane.getHorizontalScrollBarPolicy() != JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS) { int newPolicy = hsbNeeded ? JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS : JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED; if (newPolicy != dependentScrollPane.getHorizontalScrollBarPolicy()) { dependentScrollPane.setHorizontalScrollBarPolicy(newPolicy); dependentScrollPane.getViewport().invalidate(); } } } }
public void layoutContainer(Container parent) { super.layoutContainer(parent); Component view = (viewport != null) ? viewport.getView() : null; Dimension viewPrefSize = (view != null) ? view.getPreferredSize() : new Dimension(0,0); Dimension extentSize = (viewport != null) ? viewport.toViewCoordinates(viewport.getSize()) : new Dimension(0,0); boolean viewTracksViewportWidth = (view instanceof Scrollable) && ((Scrollable)view).getScrollableTracksViewportWidth(); boolean hsbNeeded = !viewTracksViewportWidth && viewPrefSize.width > extentSize.width; // enable horizontal scrollbar only if it is needed if (hsb != null) { hsb.setEnabled(hsbNeeded); } // make dependent horizontal scrollbar visible by setting scrollbar policy JScrollPane scrollPane = (JScrollPane)parent; if (scrollPane.getHorizontalScrollBarPolicy() != JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS) { int newPolicy = hsbNeeded ? JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS : JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED; if (newPolicy != dependentScrollPane.getHorizontalScrollBarPolicy()) { dependentScrollPane.setHorizontalScrollBarPolicy(newPolicy); dependentScrollPane.getViewport().invalidate(); } } } }
if (view instanceof Scrollable) { canScroll = !((Scrollable) view) .getScrollableTracksViewportWidth();
if (view instanceof Scrollable) { scrollable = (Scrollable) view; if (scrollable.getScrollableTracksViewportWidth()) viewSize.width = actualSize.width; if (scrollable.getScrollableTracksViewportHeight()) viewSize.height = actualSize.height;
/** * Returns false to indicate that the width of the viewport does not * determine the width of the layer, unless the preferred width * of the layer is smaller than the viewports width. * * @return whether the layer should track the width of the viewport * @see Scrollable * @see LayerUI#getScrollableTracksViewportWidth(JXLayer) */ public boolean getScrollableTracksViewportWidth(JXLayer<? extends V> l) { if (l.getView() instanceof Scrollable) { return ((Scrollable) l.getView()).getScrollableTracksViewportWidth(); } if (l.getParent() instanceof JViewport) { return (((JViewport) l.getParent()).getWidth() > l.getPreferredSize().width); } return false; }
boolean canScroll = true; if (view instanceof Scrollable) { canScroll = !((Scrollable)view).getScrollableTracksViewportWidth();
viewTracksViewportWidth = sv.getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv.getScrollableTracksViewportHeight(); } else { viewTracksViewportWidth = sv.getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv .getScrollableTracksViewportHeight();
if (!isEmpty && view instanceof Scrollable) { sv = (Scrollable) view; viewTracksViewportWidth = sv.getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv.getScrollableTracksViewportHeight(); } else { viewTracksViewportWidth = sv.getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv.getScrollableTracksViewportHeight(); if (vsb != null && vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED) {
boolean canScroll = true; if (view instanceof Scrollable) { canScroll = !((Scrollable) view).getScrollableTracksViewportWidth();
boolean canScroll = true; if (view instanceof Scrollable) { canScroll = !((Scrollable)view).getScrollableTracksViewportWidth();
if (view instanceof Scrollable) { Scrollable sv = (Scrollable)view; viewTracksViewportWidth = sv.getScrollableTracksViewportWidth();
if (!isEmpty && view instanceof Scrollable) { sv = (Scrollable)view; viewTracksViewportWidth = sv.getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv.getScrollableTracksViewportHeight(); } else { final boolean oldVSBNeeded = vsbNeeded; viewTracksViewportWidth = sv. getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv. getScrollableTracksViewportHeight();
if (!isEmpty && view instanceof Scrollable) { sv = (Scrollable) view; viewTracksViewportWidth = sv.getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv.getScrollableTracksViewportHeight(); } else { viewTracksViewportWidth = sv.getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv .getScrollableTracksViewportHeight();
viewTracksViewportWidth = sv.getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv.getScrollableTracksViewportHeight(); boolean oldVSBNeeded = vsbNeeded; viewTracksViewportWidth = sv. getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv. getScrollableTracksViewportHeight();
viewTracksViewportWidth = sv.getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv.getScrollableTracksViewportHeight(); boolean oldVSBNeeded = vsbNeeded; viewTracksViewportWidth = sv. getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv. getScrollableTracksViewportHeight();
boolean canScroll = true; if (view instanceof Scrollable) { canScroll = !((Scrollable)view).getScrollableTracksViewportWidth();
viewTracksViewportWidth = scrollable.getScrollableTracksViewportWidth(); viewTracksViewportHeight = scrollable.getScrollableTracksViewportHeight(); viewport.setBounds(bounds); if (scrollable != null && hsbOpaque && vsbOpaque) { viewTracksViewportWidth = scrollable.getScrollableTracksViewportWidth(); viewTracksViewportHeight = scrollable.getScrollableTracksViewportHeight(); viewportExtentSize = viewport.toViewCoordinates(bounds.getSize());
viewTracksViewportWidth = sv.getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv.getScrollableTracksViewportHeight(); boolean oldVSBNeeded = vsbNeeded; viewTracksViewportWidth = sv. getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv. getScrollableTracksViewportHeight();
boolean canScroll = true; if (view instanceof Scrollable) { canScroll = !((Scrollable) view).getScrollableTracksViewportWidth();