本文整理了Java中org.eclipse.swt.widgets.ScrollBar.getMaximum()
方法的一些代码示例,展示了ScrollBar.getMaximum()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScrollBar.getMaximum()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.ScrollBar
类名称:ScrollBar
方法名:getMaximum
[英]Returns the maximum value which the receiver will allow.
[中]返回接收器允许的最大值。
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.nebula.widgets.grid
/**
* {@inheritDoc}
*/
public int getMaximum()
{
return scrollBar.getMaximum();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt
private void checkNeedUpdate() {
if(fScrollBar != null){
if (fLastMax != fScrollBar.getMaximum() || fLastSelection != fScrollBar.getSelection()) {
this.fAbstractThemedScrollBarAdapter.fPainter.redrawScrollBars();
}
}
}
代码示例来源:origin: openaudible/openaudible
public void scrollToEnd() {
SWTAsync.assertGUI();
ScrollBar sb = consoleText.getVerticalBar();
if (sb != null) {
sb.setSelection(sb.getMaximum());
}
}
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void runSupport() {
if (isDisposed()) {
return;
}
int pos = vBar.getSelection();
if ( distance > 0 ){
pos += distance;
pos = Math.min( pos,vBar.getMaximum());
vBar.setSelection( pos );
}else{
pos += distance;
pos = Math.max( pos,vBar.getMinimum());
vBar.setSelection( pos );
}
swt_vBarChanged();
}});
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
/**
* Sets the single <em>selection</em> that is the receiver's
* value to the argument which must be greater than or equal
* to zero.
*
* @param selection the new selection (must be zero or greater)
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setSelection (int selection) {
checkWidget ();
selection = Math.min (selection, getMaximum() - getThumb());
OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED);
OS.gtk_adjustment_set_value (adjustmentHandle, selection);
OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
/**
* Sets the single <em>selection</em> that is the receiver's
* value to the argument which must be greater than or equal
* to zero.
*
* @param selection the new selection (must be zero or greater)
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setSelection (int selection) {
checkWidget ();
selection = Math.min (selection, getMaximum() - getThumb());
OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED);
OS.gtk_adjustment_set_value (adjustmentHandle, selection);
OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Sets the single <em>selection</em> that is the receiver's
* value to the argument which must be greater than or equal
* to zero.
*
* @param selection the new selection (must be zero or greater)
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setSelection (int selection) {
checkWidget ();
selection = Math.min (selection, getMaximum() - getThumb());
OS.g_signal_handlers_block_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED);
OS.gtk_adjustment_set_value (adjustmentHandle, selection);
OS.g_signal_handlers_unblock_matched (adjustmentHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, VALUE_CHANGED);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt
@Override
public void install(AbstractThemedScrollBarAdapter abstractThemedScrollBarAdapter) {
super.install(abstractThemedScrollBarAdapter);
fStyledText.addModifyListener(this);
this.fAbstractThemedScrollBarAdapter = abstractThemedScrollBarAdapter;
fTextContent = fStyledText.getContent();
fTextContent.addTextChangeListener(this);
if(fScrollBar != null){
fLastMax = fScrollBar.getMaximum();
fLastSelection = fScrollBar.getSelection();
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt
@Override
public boolean computePositions(Rectangle currClientArea, Scrollable scrollable) {
fHandleDrawnRect = null;
if (this.fScrollBar == null || this.fScrollBar.getMaximum() - this.fScrollBar.getMinimum() <= 1
|| !getVisible() || !this.fScrollBarSettings.getScrollBarThemed()) {
return false;
}
StyledText styledText = (StyledText) scrollable;
int lineWidth = getCurrentScrollBarWidth();
int w = currClientArea.width;
int h = currClientArea.height - (styledText.getTopMargin() + styledText.getBottomMargin());
this.fScrollBarPositions = new ScrollBarPositions.ScrollBarPositionsVertical(this.fScrollBar.getMinimum(),
this.fScrollBar.getMaximum(), styledText.getTopPixel(), h, w);
fHandleDrawnRect = fScrollBarPositions.getHandleDrawRect(lineWidth);
if (fHandleDrawnRect == null || h <= fHandleDrawnRect.height) {
return false;
}
return true;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt
@Override
public boolean computePositions(Rectangle currClientArea, Scrollable scrollable) {
fHandleDrawnRect = null;
if (this.fScrollBar == null || this.fScrollBar.getMaximum() - this.fScrollBar.getMinimum() <= 1
|| !getVisible() || !this.fScrollBarSettings.getScrollBarThemed()) {
return false;
}
StyledText styledText = (StyledText) scrollable;
int lineWidth = getCurrentScrollBarWidth();
int w = currClientArea.width - (styledText.getLeftMargin() + styledText.getRightMargin());
int h = currClientArea.height;
fScrollBarPositions = new ScrollBarPositions.ScrollBarPositionsHorizontal(this.fScrollBar.getMinimum(),
this.fScrollBar.getMaximum(), styledText.getHorizontalPixel(), h, w);
fHandleDrawnRect = fScrollBarPositions.getHandleDrawRect(lineWidth);
if (fHandleDrawnRect == null || w <= fHandleDrawnRect.width) {
return false;
}
return true;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.nebula.widgets.grid
/**
* {@inheritDoc}
*/
public void setSelection(int selection)
{
// RAP [if]: ScrollBar#setSelection() does not limit the value
// scrollBar.setSelection(selection);
int minimum = scrollBar.getMinimum();
int maximum = scrollBar.getMaximum();
int thumb = scrollBar.getThumb();
if( selection < minimum ) {
scrollBar.setSelection( minimum );
} else if ( selection > maximum - thumb ) {
scrollBar.setSelection( maximum - thumb );
} else {
scrollBar.setSelection( selection );
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt
@Override
public void paintControl(GC gc, Rectangle currClientArea, Scrollable scrollable) {
// At each paint, check if the content changed and keep the last
// max/selection (unfortunately, it doesn't provide a reliable way
// to listen such changes, so, we must poll it).
if(fScrollBar != null){
fLastMax = fScrollBar.getMaximum();
fLastSelection = fScrollBar.getSelection();
}
if (fTextContent != null && fStyledText.getContent() != fTextContent) {
fTextContent.removeTextChangeListener(this);
fTextContent = fStyledText.getContent();
fTextContent.addTextChangeListener(this);
}
super.paintControl(gc, currClientArea, scrollable);
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
void updateHorizontalBar (int newRightX, int rightXchange) {
if (drawCount > 0) return;
ScrollBar hBar = getHorizontalBar ();
if (hBar == null) return;
newRightX += horizontalOffset;
int barMaximum = hBar.getMaximum ();
if (newRightX > barMaximum) { /* item has extended beyond previous maximum */
hBar.setMaximum (newRightX);
int clientAreaWidth = clientArea.width;
int thumb = Math.min (newRightX, clientAreaWidth);
hBar.setThumb (thumb);
hBar.setPageIncrement (thumb);
hBar.setVisible (clientAreaWidth <= newRightX);
return;
}
int previousRightX = newRightX - rightXchange;
if (previousRightX != barMaximum) {
/* this was not the rightmost item, so just check for client width change */
int clientAreaWidth = clientArea.width;
int thumb = Math.min (barMaximum, clientAreaWidth);
hBar.setThumb (thumb);
hBar.setPageIncrement (thumb);
hBar.setVisible (clientAreaWidth <= barMaximum);
return;
}
updateHorizontalBar (); /* must search for the new rightmost item */
}
void updateVerticalBar () {
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
int inactive = 1;
if (clientArea < maximum) {
bar.setMaximum(maximum - margin);
bar.setThumb(clientArea - margin);
bar.setPageIncrement(clientArea - margin);
if (!alwaysShowScroll) bar.setVisible(true);
} else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
}
}
/**
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
int inactive = 1;
if (clientArea < maximum) {
bar.setMaximum(maximum - margin);
bar.setThumb(clientArea - margin);
bar.setPageIncrement(clientArea - margin);
if (!alwaysShowScroll) bar.setVisible(true);
} else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
}
}
/**
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
int inactive = 1;
if (clientArea < maximum) {
bar.setMaximum(maximum - margin);
bar.setThumb(clientArea - margin);
bar.setPageIncrement(clientArea - margin);
if (!alwaysShowScroll) bar.setVisible(true);
} else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
}
}
/**
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
int inactive = 1;
if (clientArea < maximum) {
bar.setMaximum(maximum - margin);
bar.setThumb(clientArea - margin);
bar.setPageIncrement(clientArea - margin);
if (!alwaysShowScroll) bar.setVisible(true);
} else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
}
}
/**
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
int inactive = 1;
if (clientArea < maximum) {
bar.setMaximum(maximum - margin);
bar.setThumb(clientArea - margin);
bar.setPageIncrement(clientArea - margin);
if (!alwaysShowScroll) bar.setVisible(true);
} else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
}
}
/**
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
if (maximum != vBar.getMaximum ()) {
vBar.setMaximum (maximum);
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
void onArrowRight (int stateMask) {
ScrollBar hBar = getHorizontalBar ();
if (hBar == null) return;
int maximum = hBar.getMaximum ();
int clientWidth = clientArea.width;
if ((horizontalOffset + clientArea.width) == maximum) return;
if (maximum <= clientWidth) return;
int newSelection = Math.min (horizontalOffset + SIZE_HORIZONTALSCROLL, maximum - clientWidth);
update ();
GC gc = new GC (this);
gc.copyArea (
0, 0,
clientArea.width, clientArea.height,
horizontalOffset - newSelection, 0);
gc.dispose ();
if (header.getVisible ()) {
Rectangle headerClientArea = header.getClientArea ();
header.update ();
gc = new GC (header);
gc.copyArea (
0, 0,
headerClientArea.width, headerClientArea.height,
horizontalOffset - newSelection, 0);
gc.dispose();
}
horizontalOffset = newSelection;
hBar.setSelection (horizontalOffset);
}
void onArrowUp (int stateMask) {
内容来源于网络,如有侵权,请联系作者删除!