当前位置: 首页>>代码示例>>Java>>正文


Java ScrollBar.setPageIncrement方法代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.ScrollBar.setPageIncrement方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollBar.setPageIncrement方法的具体用法?Java ScrollBar.setPageIncrement怎么用?Java ScrollBar.setPageIncrement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.widgets.ScrollBar的用法示例。


在下文中一共展示了ScrollBar.setPageIncrement方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resizeScrollBars

import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
void resizeScrollBars() {
	// Set the max and thumb for the image canvas scroll bars.
	ScrollBar horizontal = imageCanvas.getHorizontalBar();
	ScrollBar vertical = imageCanvas.getVerticalBar();
	Rectangle canvasBounds = imageCanvas.getClientArea();
	int width = Math.round(imageData.width * xscale);
	if (width > canvasBounds.width) {
		// The image is wider than the canvas.
		horizontal.setEnabled(true);
		horizontal.setMaximum(width);
		horizontal.setThumb(canvasBounds.width);
		horizontal.setPageIncrement(canvasBounds.width);
	}
	else {
		// The canvas is wider than the image.
		horizontal.setEnabled(false);
		if (ix != 0) {
			// Make sure the image is completely visible.
			ix = 0;
			imageCanvas.redraw();
		}
	}
	int height = Math.round(imageData.height * yscale);
	if (height > canvasBounds.height) {
		// The image is taller than the canvas.
		vertical.setEnabled(true);
		vertical.setMaximum(height);
		vertical.setThumb(canvasBounds.height);
		vertical.setPageIncrement(canvasBounds.height);
	}
	else {
		// The canvas is taller than the image.
		vertical.setEnabled(false);
		if (iy != 0) {
			// Make sure the image is completely visible.
			iy = 0;
			imageCanvas.redraw();
		}
	}
}
 
开发者ID:aroog,项目名称:code,代码行数:41,代码来源:ImageAnalyzer.java

示例2: updateScrollBarProperties

import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
/**
 * 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;
	}

}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:46,代码来源:Gallery.java

示例3: setupScrollBar

import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
private void setupScrollBar(ScrollBar sb, boolean visible, int ca, int b, int size) {
	if (sb == null)
		return;
	sb.setVisible(visible);
	if (!visible)
		sb.setSelection(0);
	else {
		sb.setPageIncrement(ca - sb.getIncrement());
		int max = b + size - ca;
		sb.setMaximum(max);
		sb.setThumb(size > max ? max : size);
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:14,代码来源:ViewerCanvas.java

示例4: updateScrollbar

import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
/**
	 * Setup the scrollbar based on the item counts specified. Note: This doesn't change the current selected position of the
	 * scrollbar.
	 * 
	 * @param scrollBar
	 *            the scrollbar to configure.
	 * @param viewportSize
	 *            how many columns or rows are currently visible in the
	 *            viewport.
	 * @param maximumSize
	 *            the maximum number of columns or rows.
	 * @param lastPageSize
	 *            the maximum number of columns or rows that currently fits onto
	 *            the last page of the viewport. For rows, this is at the bottom
	 *            of the grid, for columns this is over on the right).
	 */
	private void updateScrollbar(final ScrollBar scrollBar, final int viewportSize, final int maximumSize, final int lastPageSize, final int firstVisibleIndex, final int lastVisibleIndex, final boolean isLastCropped) {
		//
		// The scrollbar doesn't quite hold the total number of items. Because we want the last item to live at the bottom 
		// of the grid (for rows) or the right edge of the grid (for columns) rather than the top/left, we stop scrolling 
		// when the last item is in position. 
		//
		final int cappedMax = maximumSize - (lastPageSize - 1);
		
		//
		// The scrollbar is only required, if there are items beyond either of the viewport edged.
		//
		final boolean firstScrolledOff = (firstVisibleIndex > 0);               // The first row or column that's visible, ISN'T the first one, we need a scrollbar to be able to see it again.
		final boolean lastScrolledOff = ((lastVisibleIndex + 1) < maximumSize); // The last row or column that's visible, ISN'T the last one.
		final boolean visible = (firstScrolledOff || ((lastScrolledOff || (isLastCropped)) && (maximumSize > 1)));
		
		scrollBar.setMaximum(cappedMax);
		scrollBar.setThumb(1);
		scrollBar.setPageIncrement(Math.min(viewportSize, cappedMax));
		scrollBar.setIncrement(1);
		scrollBar.setVisible(visible);
		scrollBar.setEnabled(visible);
		
//		System.out.println(String.format("[%s:%s] -> Scroll page [%s] visible-rows [%s] maximum-model [%s] maximum-bar [%s] last-page [%s] last-vis-idx [%s] last-cropped [%s] firstScrolledOff [%s] lastScrolledOff [%s] visible [%s]", 
//			getData("org.eclipse.swtbot.widget.key"),
//			(scrollBar.getStyle() & SWT.VERTICAL) != 0 ? "VERTICAL" : "HORIZONTAL",  
//			scrollBar.getPageIncrement(),
//			viewportSize,
//			maximumSize,
//			scrollBar.getMaximum(),
//			lastPageSize,
//			lastVisibleIndex,
//			isLastCropped,
//			firstScrolledOff,
//			lastScrolledOff,
//			visible));
	}
 
开发者ID:GrandmasterTash,项目名称:jGrid,代码行数:53,代码来源:Grid.java

示例5: updateScrollBarsPropertiesHorizontal

import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
/**
 * Move the scrollbar to reflect the current visible items position.
 */
private void updateScrollBarsPropertiesHorizontal() {

	final ScrollBar bar = getHorizontalBar();

	if (bar == null) {
		return;
	}

	final int areaWidth = _clientArea.width;
	final int contentWidth = _contentVirtualWidthScrollbar;

	bar.setMinimum(0);
	bar.setMaximum(contentWidth);
	bar.setPageIncrement(areaWidth);
	bar.setThumb(areaWidth);

	bar.setIncrement(16);

	if (contentWidth > areaWidth) {

		// show scrollbar

		bar.setEnabled(true);
		bar.setVisible(true);
		bar.setSelection(_galleryPosition);

		// Ensure that translate has a valid value.
		validateGalleryPosition();

	} else {

		// hide scrollbar

		bar.setEnabled(false);
		bar.setVisible(false);
		bar.setSelection(0);
		_galleryPosition = 0;
	}
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:43,代码来源:GalleryMT20.java

示例6: updateScrollBarsPropertiesVertical

import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
/**
 * Move the scrollbar to reflect the current visible items position.
 */
private void updateScrollBarsPropertiesVertical() {

	final ScrollBar bar = getVerticalBar();
	if (bar == null) {
		return;
	}

	final int clientAreaSize = _clientArea.height;
	final int contentSize = _contentVirtualHeight;

	bar.setMinimum(0);
	bar.setMaximum(contentSize);
	bar.setPageIncrement(clientAreaSize);
	bar.setThumb(clientAreaSize);

	bar.setIncrement(16);

	if (contentSize > clientAreaSize) {

		// show scrollbar

		bar.setEnabled(true);
		bar.setVisible(true);
		bar.setSelection(_galleryPosition);

		// Ensure that translate has a valid value.
		validateGalleryPosition();

	} else {

		// hide scrollbar

		bar.setEnabled(false);
		bar.setVisible(false);
		bar.setSelection(0);
		_galleryPosition = 0;
	}
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:42,代码来源:GalleryMT20.java

示例7: adaptIncrements

import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
private void adaptIncrements(final ScrollBar scrollBar, final int scrollSpeedFactor) {
    if (scrollBar != null) {
        final int thumbSize = scrollBar.getThumb();
        scrollBar.setIncrement(Math.max(1, thumbSize / scrollSpeedFactor));
        scrollBar.setPageIncrement(thumbSize);
    }
}
 
开发者ID:jo-source,项目名称:jo-widgets,代码行数:8,代码来源:ScrollCompositeImpl.java

示例8: recalcScrollBars

import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
/**
 * Calculates the extends and visibility of horizontal and vertical
 * scroll bars.
 */
void recalcScrollBars() {
	ScrollBar hScrollBar = getHorizontalBar();
	ScrollBar vScrollBar = getVerticalBar();
	
	// If either horizontal or vertical scrolling is enabled
	if ((hScrollBar != null) || (vScrollBar != null)) {
		// Compute default size of control
		Point size = computeSize(SWT.DEFAULT, SWT.DEFAULT);
		// Get the visible client area
		Rectangle clientArea = getClientArea();

		if (hScrollBar != null) {
			// Show horizontal scroll bar if content does not fit horizontally
			hScrollBar.setVisible(size.x > clientArea.width);
			
			// Set the maximum horizontal scroll to be the default width of 
			// control minus what will show in the client area. 
			hScrollBar.setMaximum(size.x);
			hScrollBar.setThumb(clientArea.width);
			hScrollBar.setPageIncrement(clientArea.width);
		}
		if (vScrollBar != null) {
			// Show vertical scroll bar if content does not fit vertically
			vScrollBar.setVisible(size.y > clientArea.height);
			// Set the maximum vertical scroll to be the default height of 
			// control minus what will show in the client area. 
			vScrollBar.setMaximum(size.y);
			vScrollBar.setIncrement(verticalScrollIncrement);
			vScrollBar.setThumb(clientArea.height);
			vScrollBar.setPageIncrement(clientArea.height);
		}
	}
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:38,代码来源:DetailTree.java

示例9: updatePageIncrement

import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
/**
 * Updates the page scroll increment for given composite.
 * 
 * @param scomp
 */
public static void updatePageIncrement( ScrolledComposite scomp )
{
	ScrollBar vbar = scomp.getVerticalBar( );
	if ( vbar != null )
	{
		Rectangle clientArea = scomp.getClientArea( );
		int increment = clientArea.height - 5;
		vbar.setPageIncrement( increment );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:16,代码来源:UIUtil.java

示例10: syncScrollBars

import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
/**
 * Synchronize the scrollbar with the image. If the transform is out
 * of range, it will correct it. This function considers only following
 * factors :<b> transform, image size, client area</b>.
 */
public void syncScrollBars() {
	if (sourceImage == null) {
		redraw();
		return;
	}

	AffineTransform af = transform;
	double sx = af.getScaleX(), sy = af.getScaleY();
	double tx = af.getTranslateX(), ty = af.getTranslateY();
	if (tx > 0) tx = 0;
	if (ty > 0) ty = 0;

	ScrollBar horizontal = getHorizontalBar();
	horizontal.setIncrement(getClientArea().width / 100);
	horizontal.setPageIncrement(getClientArea().width);
	Rectangle imageBound = sourceImage.getBounds();
	int cw = getClientArea().width, ch = getClientArea().height;
	if (imageBound.width * sx > cw) { /* image is wider than client area */
		horizontal.setMaximum((int) (imageBound.width * sx));
		horizontal.setEnabled(true);
		if (((int) - tx) > horizontal.getMaximum() - cw)
			tx = -horizontal.getMaximum() + cw;
	} else { /* image is narrower than client area */
		horizontal.setEnabled(false);
		tx = (cw - imageBound.width * sx) / 2; //center if too small.
	}
	horizontal.setSelection((int) (-tx));
	horizontal.setThumb((getClientArea().width));

	ScrollBar vertical = getVerticalBar();
	vertical.setIncrement(getClientArea().height / 100);
	vertical.setPageIncrement((getClientArea().height));
	if (imageBound.height * sy > ch) { /* image is higher than client area */
		vertical.setMaximum((int) (imageBound.height * sy));
		vertical.setEnabled(true);
		if (((int) - ty) > vertical.getMaximum() - ch)
			ty = -vertical.getMaximum() + ch;
	} else { /* image is less higher than client area */
		vertical.setEnabled(false);
		ty = (ch - imageBound.height * sy) / 2; //center if too small.
	}
	vertical.setSelection((int) (-ty));
	vertical.setThumb((getClientArea().height));

	/* update transform. */
	af = AffineTransform.getScaleInstance(sx, sy);
	af.preConcatenate(AffineTransform.getTranslateInstance(tx, ty));
	transform = af;

	redraw();
}
 
开发者ID:NineWorlds,项目名称:xstreamer,代码行数:57,代码来源:SWTImageCanvas.java

示例11: syncScrollBars

import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
/**
 * SYNC the scroll-bars with the image.
 */
public void syncScrollBars( )
{
	if ( sourceImage == null )
	{
		redraw( );
		return;
	}

	AffineTransform af = transform;
	double sx = af.getScaleX( ), sy = af.getScaleY( );
	double tx = af.getTranslateX( ), ty = af.getTranslateY( );
	if ( tx > 0 )
		tx = 0;
	if ( ty > 0 )
		ty = 0;

	Rectangle imageBound = sourceImage.getBounds( );
	int cw = getClientArea( ).width, ch = getClientArea( ).height;

	ScrollBar horizontal = getHorizontalBar( );

	if ( horizontal != null )
	{
		horizontal.setIncrement( ( getClientArea( ).width / 100 ) );
		horizontal.setPageIncrement( getClientArea( ).width );

		if ( imageBound.width * sx > cw )
		{
			horizontal.setMaximum( (int) ( imageBound.width * sx ) );
			horizontal.setEnabled( true );
			if ( ( (int) -tx ) > horizontal.getMaximum( ) - cw )
				tx = -horizontal.getMaximum( ) + cw;
		}
		else
		{
			horizontal.setEnabled( false );
			tx = ( cw - imageBound.width * sx ) / 2;
		}
		horizontal.setSelection( (int) ( -tx ) );
		horizontal.setThumb( ( getClientArea( ).width ) );
	}
	ScrollBar vertical = getVerticalBar( );
	if ( vertical != null )
	{
		vertical.setIncrement( ( getClientArea( ).height / 100 ) );
		vertical.setPageIncrement( ( getClientArea( ).height ) );
		if ( imageBound.height * sy > ch )
		{
			vertical.setMaximum( (int) ( imageBound.height * sy ) );
			vertical.setEnabled( true );
			if ( ( (int) -ty ) > vertical.getMaximum( ) - ch )
				ty = -vertical.getMaximum( ) + ch;
		}
		else
		{
			vertical.setEnabled( false );
			ty = ( ch - imageBound.height * sy ) / 2;
		}
		vertical.setSelection( (int) ( -ty ) );
		vertical.setThumb( ( getClientArea( ).height ) );
	}

	af = AffineTransform.getScaleInstance( sx, sy );
	af.preConcatenate( AffineTransform.getTranslateInstance( tx, ty ) );
	transform = af;

	redraw( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:72,代码来源:IconCanvas.java

示例12: syncScrollBars

import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
/**
 * SYNC the scroll-bars with the image.
 */
public void syncScrollBars( )
{
	if ( sourceImage == null )
	{
		redraw( );
		return;
	}

	AffineTransform af = transform;
	double sx = af.getScaleX( ), sy = af.getScaleY( );
	double tx = af.getTranslateX( ), ty = af.getTranslateY( );
	if ( tx > 0 )
		tx = 0;
	if ( ty > 0 )
		ty = 0;

	Rectangle imageBound = sourceImage.getBounds( );
	int cw = getClientArea( ).width, ch = getClientArea( ).height;

	ScrollBar horizontal = getHorizontalBar( );

	if ( horizontal != null )
	{
		horizontal.setIncrement( (int) ( getClientArea( ).width / 100 ) );
		horizontal.setPageIncrement( getClientArea( ).width );

		if ( imageBound.width * sx > cw )
		{
			horizontal.setMaximum( (int) ( imageBound.width * sx ) );
			horizontal.setEnabled( true );
			if ( ( (int) -tx ) > horizontal.getMaximum( ) - cw )
				tx = -horizontal.getMaximum( ) + cw;
		}
		else
		{
			horizontal.setEnabled( false );
			tx = ( cw - imageBound.width * sx ) / 2;
		}
		horizontal.setSelection( (int) ( -tx ) );
		horizontal.setThumb( (int) ( getClientArea( ).width ) );
	}
	ScrollBar vertical = getVerticalBar( );
	if ( vertical != null )
	{
		vertical.setIncrement( (int) ( getClientArea( ).height / 100 ) );
		vertical.setPageIncrement( (int) ( getClientArea( ).height ) );
		if ( imageBound.height * sy > ch )
		{
			vertical.setMaximum( (int) ( imageBound.height * sy ) );
			vertical.setEnabled( true );
			if ( ( (int) -ty ) > vertical.getMaximum( ) - ch )
				ty = -vertical.getMaximum( ) + ch;
		}
		else
		{
			vertical.setEnabled( false );
			ty = ( ch - imageBound.height * sy ) / 2;
		}
		vertical.setSelection( (int) ( -ty ) );
		vertical.setThumb( (int) ( getClientArea( ).height ) );
	}

	af = AffineTransform.getScaleInstance( sx, sy );
	af.preConcatenate( AffineTransform.getTranslateInstance( tx, ty ) );
	transform = af;

	redraw( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:72,代码来源:ImageCanvas.java

示例13: scrollBar_updateScrollbar

import org.eclipse.swt.widgets.ScrollBar; //导入方法依赖的package包/类
private void scrollBar_updateScrollbar() {

		_scrollBar_OutsideWeeks = 0;

		final long scrollStartEpochDay = scrollBar_getStartOfTours().toEpochDay();
		final long scrollEndEpochDay = scrollBar_getEndOfTours().toEpochDay();

		final int tourWeeks = (int) ((scrollEndEpochDay - scrollStartEpochDay) / 7);

		// ensure max contains all visible weeks in the viewport
		int scrollbarMax = Math.max(_numWeeksInOneColumn, tourWeeks) + 2;

		// ensure the thumb isn't getting to small
		final int thumbSize = Math.max(_numWeeksInOneColumn, scrollbarMax / 20);

		final long firstViewportDay = _firstVisibleDay.toLocalDate().toEpochDay();
		int scrollbarSelection;

		if (firstViewportDay < scrollStartEpochDay) {

			// shift negative

			_scrollBar_OutsideWeeks = (int) ((firstViewportDay - scrollStartEpochDay) / 7);
			scrollbarSelection = 1;//1;

		} else if (firstViewportDay > scrollEndEpochDay) {

			// shift positive

			_scrollBar_OutsideWeeks = (int) ((firstViewportDay - scrollEndEpochDay) / 7);
			scrollbarSelection = scrollbarMax - 1;

		} else {

			scrollbarSelection = (int) ((firstViewportDay - scrollStartEpochDay) / 7);
		}

		// scrollbars and thums are complicated !!!
		scrollbarMax += thumbSize;

		// update scrollbar
		_isInUpdateScrollbar = true;
		final ScrollBar scrollbar = _parent.getVerticalBar();

		scrollbar.setThumb(thumbSize);
		scrollbar.setPageIncrement(thumbSize);

		scrollbar.setMinimum(0);
		scrollbar.setMaximum(scrollbarMax);

		scrollbar.setSelection(scrollbarSelection);

		_scrollBar_LastSelection = scrollbarSelection;
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:55,代码来源:CalendarGraph.java


注:本文中的org.eclipse.swt.widgets.ScrollBar.setPageIncrement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。