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


Java ScrollBar.getThumb方法代码示例

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


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

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

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

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

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

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

示例8: 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.getThumb方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。