Java Code Examples for org.eclipse.swt.widgets.ScrollBar#setVisible()
The following examples show how to use
org.eclipse.swt.widgets.ScrollBar#setVisible() .
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: ParameterExpandBar.java From gama with GNU General Public License v3.0 | 6 votes |
void setScrollbar() { if (itemCount == 0) { return; } final ScrollBar verticalBar = getVerticalBar(); if (verticalBar == null) { return; } final int height = getClientArea().height; final ParameterExpandItem item = items[itemCount - 1]; int maxHeight = item.y + bandHeight + spacing; if (item.expanded) { maxHeight += item.height; } // claim bottom free space if (yCurrentScroll > 0 && height > maxHeight) { yCurrentScroll = Math.max(0, yCurrentScroll + maxHeight - height); layoutItems(0, false); } maxHeight += yCurrentScroll; final int selection = Math.min(yCurrentScroll, maxHeight); final int increment = verticalBar.getIncrement(); final int pageIncrement = verticalBar.getPageIncrement(); verticalBar.setValues(selection, 0, maxHeight, height, increment, pageIncrement); verticalBar.setVisible(maxHeight > height); }
Example 2
Source File: BaseSourceViewer.java From Pydev with Eclipse Public License 1.0 | 6 votes |
@Override protected StyledText createTextWidget(Composite parent, int styles) { StyledTextWithoutVerticalBar styledText = new StyledTextWithoutVerticalBar(parent, styles); if (!MinimapOverviewRulerPreferencesPage.getShowVerticalScrollbar()) { ScrollBar verticalBar = styledText.getVerticalBar(); if (verticalBar != null) { verticalBar.setVisible(false); } } if (!MinimapOverviewRulerPreferencesPage.getShowHorizontalScrollbar()) { ScrollBar horizontalBar = styledText.getHorizontalBar(); if (horizontalBar != null) { horizontalBar.setVisible(false); } } return styledText; }
Example 3
Source File: Gallery.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Move the scrollbar to reflect the current visible items position. * * @param bar * - the scroll bar to move * @param clientSize * - Client (visible) area size * @param totalSize * - Total Size */ private void updateScrollBarProperties(ScrollBar bar, int clientSize, int totalSize) { if (bar == null) return; bar.setMinimum(0); bar.setPageIncrement(clientSize); bar.setMaximum(totalSize); bar.setThumb(clientSize); // Let the group renderer use a custom increment value. if (groupRenderer != null) bar.setIncrement(groupRenderer.getScrollBarIncrement()); if (totalSize > clientSize) { if (DEBUG) System.out.println("Enabling scrollbar"); //$NON-NLS-1$ bar.setEnabled(true); bar.setVisible(true); bar.setSelection(translate); // Ensure that translate has a valid value. validateTranslation(); } else { if (DEBUG) System.out.println("Disabling scrollbar"); //$NON-NLS-1$ bar.setEnabled(false); bar.setVisible(false); bar.setSelection(0); translate = 0; } }