當前位置: 首頁>>代碼示例>>Java>>正文


Java ScrollBar.getMaximum方法代碼示例

本文整理匯總了Java中org.eclipse.swt.widgets.ScrollBar.getMaximum方法的典型用法代碼示例。如果您正苦於以下問題:Java ScrollBar.getMaximum方法的具體用法?Java ScrollBar.getMaximum怎麽用?Java ScrollBar.getMaximum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.swt.widgets.ScrollBar的用法示例。


在下文中一共展示了ScrollBar.getMaximum方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: smartScroll

import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
protected void smartScroll(boolean force) {
	ScrollBar scrollbar = chatConsole.inputText.getVerticalBar();
	if (scrollbar != null
			&& scrollbar.isVisible()
			&& getPreferences().getBoolean(
					PreferenceKeys.CHAT_IS_SMART_SCROLL_ENABLED)) {

		if (force) {
			setAutoScrolling(true);
		}
		else if (scrollbar.getMaximum() == scrollbar.getSelection()
				+ scrollbar.getThumb()) {
			setAutoScrolling(true);
		} else {
			setAutoScrolling(false);
		}
	}
}
 
開發者ID:evilwan,項目名稱:raptor-chess-interface,代碼行數:19,代碼來源:ChatConsoleController.java

示例2: pageUp

import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
private void pageUp() {
	//
	// Ensure there's an anchor.
	//
	ensureAnchorSet();
	
	//
	// Move the scrollbar down one page.
	//
	final ScrollBar verticalBar = grid.getVerticalBar();
	verticalBar.setSelection(Math.max(verticalBar.getSelection() - verticalBar.getPageIncrement(), verticalBar.getMinimum()));
	
	//
	// Cause a repaint.
	//
	gridModel.fireChangeEvent();
	
	//
	// Move the anchor to the new page.
	//
	if (verticalBar.getSelection() != verticalBar.getMaximum()) {
		final Row<T> row = gridModel.getRows().get(grid.getViewport().getFirstRowIndex());
		gridModel.getSelectionModel().setAnchorElement(row.getElement());
	}
}
 
開發者ID:GrandmasterTash,項目名稱:jGrid,代碼行數:26,代碼來源:GridKeyboardHandler.java

示例3: pageDown

import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
private void pageDown() {
	//
	// Ensure there's an anchor.
	//
	ensureAnchorSet();
	
	//
	// Move the scrollbar down one page.
	//
	final ScrollBar verticalBar = grid.getVerticalBar();
	verticalBar.setSelection(Math.min(verticalBar.getSelection() + verticalBar.getPageIncrement(), verticalBar.getMaximum()));
	
	//
	// Cause a repaint.
	//
	gridModel.fireChangeEvent();
	
	//
	// Move the anchor to the new page.
	//
	if (verticalBar.getSelection() != verticalBar.getMaximum()) {
		final Row<T> row = gridModel.getRows().get(grid.getViewport().getFirstRowIndex());
		gridModel.getSelectionModel().setAnchorElement(row.getElement());
	}
}
 
開發者ID:GrandmasterTash,項目名稱:jGrid,代碼行數:26,代碼來源:GridKeyboardHandler.java

示例4: addToLog

import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
/**
 * Adds an {@link EventContainer} to the log. Only add the values/occurrences defined by
 * the list of descriptors. If an event is configured to be displayed by value and occurrence,
 * only the values are displayed (as they mark an event occurrence anyway).
 * <p/>This method is only called when at least one of the descriptor list is non empty.
 *
 * @param event
 * @param logParser
 * @param valueDescriptors
 * @param occurrenceDescriptors
 */
protected void addToLog(EventContainer event, EventLogParser logParser,
        ArrayList<ValueDisplayDescriptor> valueDescriptors,
        ArrayList<OccurrenceDisplayDescriptor> occurrenceDescriptors) {
    ScrollBar bar = mLogTable.getVerticalBar();
    boolean scroll = bar.getMaximum() == bar.getSelection() + bar.getThumb();

    // get the date.
    Calendar c = Calendar.getInstance();
    long msec = event.sec * 1000L;
    c.setTimeInMillis(msec);

    // convert the time into a string
    String date = String.format("%1$tF %1$tT", c);

    String eventName = logParser.getTagMap().get(event.mTag);
    String pidName = Integer.toString(event.pid);

    if (valueDescriptors.size() > 0) {
        for (ValueDisplayDescriptor descriptor : valueDescriptors) {
            logDescriptor(event, descriptor, date, pidName, eventName, logParser);
        }
    } else {
        // we display the event. Since the StringBuilder contains the header (date, event name,
        // pid) at this point, there isn't anything else to display.
    }

    // scroll if needed, by showing the last item
    if (scroll) {
        int itemCount = mLogTable.getItemCount();
        if (itemCount > 0) {
            mLogTable.showItem(mLogTable.getItem(itemCount - 1));
        }
    }
}
 
開發者ID:utds3lab,項目名稱:SMVHunter,代碼行數:46,代碼來源:DisplayLog.java

示例5: update

import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
/***************************************************************************
 * Update this dialog
 **************************************************************************/
public void update()
{
	m_items.getTable().deselectAll();
	m_items.refresh(true);
	// Show the last item
	ScrollBar vertical = m_items.getTable().getVerticalBar();
	int maximum = vertical.getMaximum();
	int thumb = vertical.getThumb();
	int current = vertical.getSelection();
	if (current >= maximum - thumb)
	{
		m_items.reveal(m_items.getElementAt(m_items.getTable().getItemCount() - 1));
	}
}
 
開發者ID:Spacecraft-Code,項目名稱:SPELL,代碼行數:18,代碼來源:ItemInfoDialog.java

示例6: handleEvent

import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
public void handleEvent(Event event) {
	// Remove standard behavior
	event.doit = false;

	// Get scrollbar on which the event occurred.
	ScrollBar currentScrollBar = getScrollbar(event);

	int start = currentScrollBar.getSelection();
	int end = start;

	// If an effect is currently running, get the current and target
	// values.
	IEffect current = animationRunner.getEffect();
	if (current instanceof MoveScrollBarEffect) {
		MoveScrollBarEffect mseffect = (MoveScrollBarEffect) current;
		start = mseffect.getCurrent();
		end = mseffect.getEnd();
	}

	end -= event.count * currentScrollBar.getIncrement();

	if (end > currentScrollBar.getMaximum()
			- currentScrollBar.getThumb()) {
		end = currentScrollBar.getMaximum()
				- currentScrollBar.getThumb();
	}

	if (end < currentScrollBar.getMinimum()) {
		end = currentScrollBar.getMinimum();
	}

	animationRunner.runEffect(new MoveScrollBarEffect(currentScrollBar,
			start, end, duration, movement, null, null));

}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:36,代碼來源:ScrollingSmoother.java

示例7: saveScrollState

import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
public void saveScrollState(ScrollBar scrollBar) {
	this.selection = scrollBar.getSelection();
	this.minimum = scrollBar.getMinimum();
	this.maximum = scrollBar.getMaximum();
	this.thumb = scrollBar.getThumb();
	this.increment = scrollBar.getIncrement();
	this.pageIncrement = scrollBar.getPageIncrement();
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:9,代碼來源:Day.java

示例8: scrollTable

import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
private void scrollTable( ScrollBar widget, KeyEvent event )
{
	int newSelectionValue = widget.getSelection( );
	if ( event.keyCode == SWT.ARROW_LEFT )
	{
		newSelectionValue -= TableCanvas.SCROLL_HORIZONTAL_STEP;
	}
	else if ( event.keyCode == SWT.ARROW_RIGHT )
	{
		newSelectionValue += TableCanvas.SCROLL_HORIZONTAL_STEP;
	}
	else if ( event.keyCode == SWT.PAGE_UP 
			|| event.keyCode == SWT.ARROW_UP )
	{
		newSelectionValue -= 1;
	}
	else if ( event.keyCode == SWT.PAGE_DOWN
			|| event.keyCode == SWT.ARROW_DOWN )
	{
		newSelectionValue += 1;
	}

	if ( newSelectionValue < widget.getMinimum( ) )
	{
		newSelectionValue = widget.getMinimum( );
	}
	else if ( newSelectionValue > widget.getMaximum( ) )
	{
		newSelectionValue = widget.getMaximum( );
	}

	widget.setSelection( newSelectionValue );
	Event newEvent = new Event( );
	newEvent.widget = widget;
	newEvent.type = SWT.Selection;
	newEvent.data = event.data;
	widget.notifyListeners( SWT.Selection, newEvent );
}
 
開發者ID:eclipse,項目名稱:birt,代碼行數:39,代碼來源:CustomPreviewTable.java

示例9: 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

示例10: flush

import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
/**
 * Takes all the accepted messages and display them.
 * This must be called from a UI thread.
 */
@UiThread
public void flush() {
    // if scroll bar is at the bottom, we will scroll
    ScrollBar bar = mTable.getVerticalBar();
    boolean scroll = bar.getMaximum() == bar.getSelection() + bar.getThumb();

    // if we are not going to scroll, get the current first item being shown.
    int topIndex = mTable.getTopIndex();

    // disable drawing
    mTable.setRedraw(false);

    int totalCount = mNewMessages.size();

    try {
        // remove the items of the old messages.
        for (int i = 0 ; i < mRemovedMessageCount && mTable.getItemCount() > 0 ; i++) {
            mTable.remove(0);
        }
        mRemovedMessageCount = 0;

        if (mUnreadCount > mTable.getItemCount()) {
            mUnreadCount = mTable.getItemCount();
        }

        // add the new items
        for (int i = 0  ; i < totalCount ; i++) {
            LogMessage msg = mNewMessages.get(i);
            addTableItem(msg);
        }
    } catch (SWTException e) {
        // log the error and keep going. Content of the logcat table maybe unexpected
        // but at least ddms won't crash.
        Log.e("LogFilter", e);
    }

    // redraw
    mTable.setRedraw(true);

    // scroll if needed, by showing the last item
    if (scroll) {
        totalCount = mTable.getItemCount();
        if (totalCount > 0) {
            mTable.showItem(mTable.getItem(totalCount-1));
        }
    } else if (mRemovedMessageCount > 0) {
        // we need to make sure the topIndex is still visible.
        // Because really old items are removed from the list, this could make it disappear
        // if we don't change the scroll value at all.

        topIndex -= mRemovedMessageCount;
        if (topIndex < 0) {
            // looks like it disappeared. Lets just show the first item
            mTable.showItem(mTable.getItem(0));
        } else {
            mTable.showItem(mTable.getItem(topIndex));
        }
    }

    // if this filter is not the current one, we update the tab text
    // with the amount of unread message
    if (mIsCurrentTabItem == false) {
        mUnreadCount += mNewMessages.size();
        totalCount = mTable.getItemCount();
        if (mUnreadCount > 0) {
            mTabItem.setText(mName + " (" //$NON-NLS-1$
                    + (mUnreadCount > totalCount ? totalCount : mUnreadCount)
                    + ")");  //$NON-NLS-1$
        } else {
            mTabItem.setText(mName);  //$NON-NLS-1$
        }
    }

    mNewMessages.clear();
}
 
開發者ID:utds3lab,項目名稱:SMVHunter,代碼行數:80,代碼來源:LogFilter.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: expectedSize

import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
private Point expectedSize() {
  ScrollBar horizontalBar = scrollable.getHorizontalBar();
  return new Point( horizontalBar.getMaximum(), computePreferredScrollableSize().y );
}
 
開發者ID:fappel,項目名稱:xiliary,代碼行數:5,代碼來源:SizeComputerTest.java

示例14: expectedSizeWithPreferredWidthAdjustment

import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
private Point expectedSizeWithPreferredWidthAdjustment() {
  ScrollBar horizontalBar = scrollable.getHorizontalBar();
  return new Point( horizontalBar.getMaximum() * 2, computePreferredScrollableSize().y );
}
 
開發者ID:fappel,項目名稱:xiliary,代碼行數:5,代碼來源:SizeComputerTest.java

示例15: scrollBar_onScroll

import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
/**
	 * Called when scrolled with the scrollbar slider
	 * 
	 * @param event
	 */
	private void scrollBar_onScroll(final SelectionEvent event) {

		if (_isInUpdateScrollbar) {

			// prevent additional scrolling

			_isInUpdateScrollbar = false;

			return;
		}

		final ScrollBar scrollbar = _parent.getVerticalBar();

		final int selectableMin = 0 + 1;
		final int selectableMax = scrollbar.getMaximum() - scrollbar.getThumb() - 1;

		final int currentSelection = scrollbar.getSelection();
		final int selectionDiff = currentSelection - _scrollBar_LastSelection;

		if (_scrollBar_OutsideWeeks == 0) {

			// scrolled is inside tour weeks

			if (currentSelection < selectableMin) {

				// we are at the upper border

//				sb.setSelection(selectableMin);
				_scrollBar_OutsideWeeks += selectionDiff;
			}

			if (currentSelection > selectableMax) {

				// we are at the lower border

//				sb.setSelection(selectableMax);
				_scrollBar_OutsideWeeks += selectionDiff;

			}

		} else {

			// scrolled is outside of the tour weeks

			if (_scrollBar_LastSelection == selectableMax) {
//				sb.setSelection(selectableMax);
			} else if (_scrollBar_LastSelection == selectableMin) {
//				sb.setSelection(selectableMin);
			}

			if (selectionDiff > 0 && _scrollBar_OutsideWeeks < 0) {

				// ensure we are not shifting over "0"
				_scrollBar_OutsideWeeks = Math.min(0, _scrollBar_OutsideWeeks + selectionDiff);

			} else if (selectionDiff < 0 && _scrollBar_OutsideWeeks > 0) {

				_scrollBar_OutsideWeeks = Math.max(0, _scrollBar_OutsideWeeks + selectionDiff);

			} else {
				_scrollBar_OutsideWeeks += selectionDiff;
			}

		}

		_scrollBar_LastSelection = scrollbar.getSelection();

		// goto the selected week
		_firstVisibleDay = scrollBar_getStartOfTours().atStartOfDay().plusDays(currentSelection * 7);

		_yearColumn_FirstYear = _firstVisibleDay;

		_isGraphDirty = true;
		redraw();
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:81,代碼來源:CalendarGraph.java


注:本文中的org.eclipse.swt.widgets.ScrollBar.getMaximum方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。