Java Code Examples for javax.swing.JScrollBar#getVisibleAmount()
The following examples show how to use
javax.swing.JScrollBar#getVisibleAmount() .
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: Test6526631.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public void validateThird() { JViewport viewport = this.pane.getViewport(); JScrollBar scroller = this.pane.getHorizontalScrollBar(); if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) { throw new Error("unexpected component orientation"); } int value = scroller.getValue(); if (value != 0) { throw new Error("unexpected scroll value"); } int extent = viewport.getExtentSize().width; if (extent != scroller.getVisibleAmount()) { throw new Error("unexpected visible amount"); } int size = viewport.getViewSize().width; if (size != scroller.getMaximum()) { throw new Error("unexpected maximum"); } int pos = size - extent - value; if (pos != viewport.getViewPosition().x) { throw new Error("unexpected position"); } }
Example 2
Source File: ScrollablePopupMenu.java From jaamsim with Apache License 2.0 | 6 votes |
@Override public Dimension preferredLayoutSize(Container parent) { // Find the visible portion of the scroll bar int visibleAmount = Integer.MAX_VALUE; JScrollBar scrollBar = getScrollBar(parent); if (scrollBar != null) { visibleAmount = scrollBar.getVisibleAmount(); } // Return the adjusted height of the menu Dimension ret = getSize(parent); Insets insets = parent.getInsets(); ret.height = Math.min(ret.height + insets.top + insets.bottom, visibleAmount); return ret; }
Example 3
Source File: Test6526631.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public void validateThird() { JViewport viewport = this.pane.getViewport(); JScrollBar scroller = this.pane.getHorizontalScrollBar(); if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) { throw new Error("unexpected component orientation"); } int value = scroller.getValue(); if (value != 0) { throw new Error("unexpected scroll value"); } int extent = viewport.getExtentSize().width; if (extent != scroller.getVisibleAmount()) { throw new Error("unexpected visible amount"); } int size = viewport.getViewSize().width; if (size != scroller.getMaximum()) { throw new Error("unexpected maximum"); } int pos = size - extent - value; if (pos != viewport.getViewPosition().x) { throw new Error("unexpected position"); } }
Example 4
Source File: Test6526631.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void validateThird() { JViewport viewport = this.pane.getViewport(); JScrollBar scroller = this.pane.getHorizontalScrollBar(); if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) { throw new Error("unexpected component orientation"); } int value = scroller.getValue(); if (value != 0) { throw new Error("unexpected scroll value"); } int extent = viewport.getExtentSize().width; if (extent != scroller.getVisibleAmount()) { throw new Error("unexpected visible amount"); } int size = viewport.getViewSize().width; if (size != scroller.getMaximum()) { throw new Error("unexpected maximum"); } int pos = size - extent - value; if (pos != viewport.getViewPosition().x) { throw new Error("unexpected position"); } }
Example 5
Source File: JScrollPopupMenu.java From zap-extensions with Apache License 2.0 | 6 votes |
@Override public Dimension minimumLayoutSize(Container parent) { int visibleAmount = Integer.MAX_VALUE; Dimension dim = new Dimension(); for(Component comp : parent.getComponents()) { if(comp.isVisible()){ if(comp instanceof JScrollBar) { JScrollBar scrollBar = (JScrollBar) comp; visibleAmount = scrollBar.getVisibleAmount(); } else { Dimension min = comp.getMinimumSize(); dim.width = Math.max(dim.width, min.width); dim.height += min.height; } } } Insets insets = parent.getInsets(); dim.height = Math.min(dim.height + insets.top + insets.bottom, visibleAmount); return dim; }
Example 6
Source File: JScrollPopupMenu.java From zap-extensions with Apache License 2.0 | 6 votes |
@Override public Dimension preferredLayoutSize(Container parent) { int visibleAmount = Integer.MAX_VALUE; Dimension dim = new Dimension(); for(Component comp :parent.getComponents()){ if(comp.isVisible()) { if(comp instanceof JScrollBar){ JScrollBar scrollBar = (JScrollBar) comp; visibleAmount = scrollBar.getVisibleAmount(); } else { Dimension pref = comp.getPreferredSize(); dim.width = Math.max(dim.width, pref.width); dim.height += pref.height; } } } Insets insets = parent.getInsets(); dim.height = Math.min(dim.height + insets.top + insets.bottom, visibleAmount); return dim; }
Example 7
Source File: EULADialog.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * Listens to changes of the scroll bar of the text are showing the EULA text, enables the check * box once the user scrolled to the end of the document. */ @Override public void adjustmentValueChanged(AdjustmentEvent e) { JScrollBar scrollBar = this.scrollPane.getVerticalScrollBar(); if (e.getSource() == scrollBar) { // the maximum value of the scroll bar assumes that the content is // not visible anymore, since this is not the case when scrolling // to the end of the document (the last part is still visible), // we have to include the visible amount in the comparison int currentValue = scrollBar.getValue() + scrollBar.getVisibleAmount(); if (currentValue >= scrollBar.getMaximum()) { // the user scrolled to the end of the document this.acceptCheckBox.setEnabled(true); this.acceptCheckBox.requestFocusInWindow(); } } }
Example 8
Source File: Test6526631.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public void validateThird() { JViewport viewport = this.pane.getViewport(); JScrollBar scroller = this.pane.getHorizontalScrollBar(); if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) { throw new Error("unexpected component orientation"); } int value = scroller.getValue(); if (value != 0) { throw new Error("unexpected scroll value"); } int extent = viewport.getExtentSize().width; if (extent != scroller.getVisibleAmount()) { throw new Error("unexpected visible amount"); } int size = viewport.getViewSize().width; if (size != scroller.getMaximum()) { throw new Error("unexpected maximum"); } int pos = size - extent - value; if (pos != viewport.getViewPosition().x) { throw new Error("unexpected position"); } }
Example 9
Source File: Test6526631.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void validateThird() { JViewport viewport = this.pane.getViewport(); JScrollBar scroller = this.pane.getHorizontalScrollBar(); if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) { throw new Error("unexpected component orientation"); } int value = scroller.getValue(); if (value != 0) { throw new Error("unexpected scroll value"); } int extent = viewport.getExtentSize().width; if (extent != scroller.getVisibleAmount()) { throw new Error("unexpected visible amount"); } int size = viewport.getViewSize().width; if (size != scroller.getMaximum()) { throw new Error("unexpected maximum"); } int pos = size - extent - value; if (pos != viewport.getViewPosition().x) { throw new Error("unexpected position"); } }
Example 10
Source File: Test6526631.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public void validateThird() { JViewport viewport = this.pane.getViewport(); JScrollBar scroller = this.pane.getHorizontalScrollBar(); if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) { throw new Error("unexpected component orientation"); } int value = scroller.getValue(); if (value != 0) { throw new Error("unexpected scroll value"); } int extent = viewport.getExtentSize().width; if (extent != scroller.getVisibleAmount()) { throw new Error("unexpected visible amount"); } int size = viewport.getViewSize().width; if (size != scroller.getMaximum()) { throw new Error("unexpected maximum"); } int pos = size - extent - value; if (pos != viewport.getViewPosition().x) { throw new Error("unexpected position"); } }
Example 11
Source File: Test6526631.java From hottub with GNU General Public License v2.0 | 6 votes |
public void validateThird() { JViewport viewport = this.pane.getViewport(); JScrollBar scroller = this.pane.getHorizontalScrollBar(); if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) { throw new Error("unexpected component orientation"); } int value = scroller.getValue(); if (value != 0) { throw new Error("unexpected scroll value"); } int extent = viewport.getExtentSize().width; if (extent != scroller.getVisibleAmount()) { throw new Error("unexpected visible amount"); } int size = viewport.getViewSize().width; if (size != scroller.getMaximum()) { throw new Error("unexpected maximum"); } int pos = size - extent - value; if (pos != viewport.getViewPosition().x) { throw new Error("unexpected position"); } }
Example 12
Source File: Test6526631.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void validateThird() { JViewport viewport = this.pane.getViewport(); JScrollBar scroller = this.pane.getHorizontalScrollBar(); if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) { throw new Error("unexpected component orientation"); } int value = scroller.getValue(); if (value != 0) { throw new Error("unexpected scroll value"); } int extent = viewport.getExtentSize().width; if (extent != scroller.getVisibleAmount()) { throw new Error("unexpected visible amount"); } int size = viewport.getViewSize().width; if (size != scroller.getMaximum()) { throw new Error("unexpected maximum"); } int pos = size - extent - value; if (pos != viewport.getViewPosition().x) { throw new Error("unexpected position"); } }
Example 13
Source File: Test6526631.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void validateThird() { JViewport viewport = this.pane.getViewport(); JScrollBar scroller = this.pane.getHorizontalScrollBar(); if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) { throw new Error("unexpected component orientation"); } int value = scroller.getValue(); if (value != 0) { throw new Error("unexpected scroll value"); } int extent = viewport.getExtentSize().width; if (extent != scroller.getVisibleAmount()) { throw new Error("unexpected visible amount"); } int size = viewport.getViewSize().width; if (size != scroller.getMaximum()) { throw new Error("unexpected maximum"); } int pos = size - extent - value; if (pos != viewport.getViewPosition().x) { throw new Error("unexpected position"); } }
Example 14
Source File: Test6526631.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void validateThird() { JViewport viewport = this.pane.getViewport(); JScrollBar scroller = this.pane.getHorizontalScrollBar(); if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) { throw new Error("unexpected component orientation"); } int value = scroller.getValue(); if (value != 0) { throw new Error("unexpected scroll value"); } int extent = viewport.getExtentSize().width; if (extent != scroller.getVisibleAmount()) { throw new Error("unexpected visible amount"); } int size = viewport.getViewSize().width; if (size != scroller.getMaximum()) { throw new Error("unexpected maximum"); } int pos = size - extent - value; if (pos != viewport.getViewPosition().x) { throw new Error("unexpected position"); } }
Example 15
Source File: Test6526631.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void validateThird() { JViewport viewport = this.pane.getViewport(); JScrollBar scroller = this.pane.getHorizontalScrollBar(); if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) { throw new Error("unexpected component orientation"); } int value = scroller.getValue(); if (value != 0) { throw new Error("unexpected scroll value"); } int extent = viewport.getExtentSize().width; if (extent != scroller.getVisibleAmount()) { throw new Error("unexpected visible amount"); } int size = viewport.getViewSize().width; if (size != scroller.getMaximum()) { throw new Error("unexpected maximum"); } int pos = size - extent - value; if (pos != viewport.getViewPosition().x) { throw new Error("unexpected position"); } }
Example 16
Source File: Test6526631.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void validateThird() { JViewport viewport = this.pane.getViewport(); JScrollBar scroller = this.pane.getHorizontalScrollBar(); if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) { throw new Error("unexpected component orientation"); } int value = scroller.getValue(); if (value != 0) { throw new Error("unexpected scroll value"); } int extent = viewport.getExtentSize().width; if (extent != scroller.getVisibleAmount()) { throw new Error("unexpected visible amount"); } int size = viewport.getViewSize().width; if (size != scroller.getMaximum()) { throw new Error("unexpected maximum"); } int pos = size - extent - value; if (pos != viewport.getViewPosition().x) { throw new Error("unexpected position"); } }
Example 17
Source File: Test6526631.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void validateThird() { JViewport viewport = this.pane.getViewport(); JScrollBar scroller = this.pane.getHorizontalScrollBar(); if (!scroller.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) { throw new Error("unexpected component orientation"); } int value = scroller.getValue(); if (value != 0) { throw new Error("unexpected scroll value"); } int extent = viewport.getExtentSize().width; if (extent != scroller.getVisibleAmount()) { throw new Error("unexpected visible amount"); } int size = viewport.getViewSize().width; if (size != scroller.getMaximum()) { throw new Error("unexpected maximum"); } int pos = size - extent - value; if (pos != viewport.getViewPosition().x) { throw new Error("unexpected position"); } }
Example 18
Source File: DiscoveryPanel.java From nanoleaf-desktop with MIT License | 5 votes |
private void updateEffectsByScroll(JScrollBar bar) { if (bar.getValue() == bar.getMaximum() - bar.getVisibleAmount() && !isUpdating) { topPage++; updateEffects(); } }