本文整理汇总了Java中org.eclipse.draw2d.FigureCanvas.scrollToY方法的典型用法代码示例。如果您正苦于以下问题:Java FigureCanvas.scrollToY方法的具体用法?Java FigureCanvas.scrollToY怎么用?Java FigureCanvas.scrollToY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.draw2d.FigureCanvas
的用法示例。
在下文中一共展示了FigureCanvas.scrollToY方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scrollPageIncrement
import org.eclipse.draw2d.FigureCanvas; //导入方法依赖的package包/类
private boolean scrollPageIncrement( GraphicalEditPart part, int code )
{
if ( !( part.getViewer( ) instanceof DeferredGraphicalViewer ) )
{
return false;
}
DeferredGraphicalViewer viewer = (DeferredGraphicalViewer) part.getViewer( );
FigureCanvas canvas = viewer.getFigureCanvas( );
int increment = 0;
if ( code == SWT.PAGE_DOWN )
{
increment = canvas.getVerticalBar( ).getSelection( )
+ canvas.getVerticalBar( ).getPageIncrement( );
}
else if ( code == SWT.PAGE_UP )
{
increment = canvas.getVerticalBar( ).getSelection( )
- canvas.getVerticalBar( ).getPageIncrement( );
}
canvas.scrollToY( increment );
return true;
}
示例2: scrollViewer
import org.eclipse.draw2d.FigureCanvas; //导入方法依赖的package包/类
void scrollViewer( KeyEvent event )
{
if ( !( getViewer( ).getControl( ) instanceof FigureCanvas ) )
return;
FigureCanvas figCanvas = (FigureCanvas) getViewer( ).getControl( );
Point loc = figCanvas.getViewport( ).getViewLocation( );
Rectangle area = figCanvas.getViewport( )
.getClientArea( Rectangle.SINGLETON )
.scale( .1 );
switch ( event.keyCode )
{
case SWT.ARROW_DOWN :
figCanvas.scrollToY( loc.y + area.height );
break;
case SWT.ARROW_UP :
figCanvas.scrollToY( loc.y - area.height );
break;
case SWT.ARROW_LEFT :
figCanvas.scrollToX( loc.x - area.width );
break;
case SWT.ARROW_RIGHT :
figCanvas.scrollToX( loc.x + area.width );
}
}
示例3: scrollViewer
import org.eclipse.draw2d.FigureCanvas; //导入方法依赖的package包/类
void scrollViewer(KeyEvent event) {
if (!(getViewer().getControl() instanceof FigureCanvas))
return;
FigureCanvas figCanvas = (FigureCanvas) getViewer().getControl();
Point loc = figCanvas.getViewport().getViewLocation();
Rectangle area = figCanvas.getViewport()
.getClientArea(Rectangle.SINGLETON).scale(.1);
switch (event.keyCode) {
case SWT.ARROW_DOWN:
figCanvas.scrollToY(loc.y + area.height);
break;
case SWT.ARROW_UP:
figCanvas.scrollToY(loc.y - area.height);
break;
case SWT.ARROW_LEFT:
if (isViewerMirrored())
figCanvas.scrollToX(loc.x + area.width);
else
figCanvas.scrollToX(loc.x - area.width);
break;
case SWT.ARROW_RIGHT:
if (isViewerMirrored())
figCanvas.scrollToX(loc.x - area.width);
else
figCanvas.scrollToX(loc.x + area.width);
}
}
示例4: scrollIncrement
import org.eclipse.draw2d.FigureCanvas; //导入方法依赖的package包/类
private boolean scrollIncrement( GraphicalEditPart part, KeyEvent event )
{
if ( ( event.stateMask & SWT.CONTROL ) == 0 )
{
return false;
}
if ( !( part.getViewer( ) instanceof DeferredGraphicalViewer ) )
{
return false;
}
DeferredGraphicalViewer viewer = (DeferredGraphicalViewer) part.getViewer( );
FigureCanvas canvas = viewer.getFigureCanvas( );
int code = event.keyCode;
int increment = 0;
if ( code == SWT.ARROW_RIGHT )
{
increment = canvas.getHorizontalBar( ).getSelection( )
+ canvas.getHorizontalBar( ).getIncrement( );
}
else if ( code == SWT.ARROW_LEFT )
{
increment = canvas.getHorizontalBar( ).getSelection( )
- canvas.getHorizontalBar( ).getIncrement( );
}
else if ( code == SWT.ARROW_DOWN )
{
increment = canvas.getVerticalBar( ).getSelection( )
+ canvas.getVerticalBar( ).getIncrement( );
}
else if ( code == SWT.ARROW_UP )
{
increment = canvas.getVerticalBar( ).getSelection( )
- canvas.getVerticalBar( ).getIncrement( );
}
if ( code == SWT.ARROW_RIGHT || code == SWT.ARROW_LEFT )
{
canvas.scrollToX( increment );
}
if ( code == SWT.ARROW_UP || code == SWT.ARROW_DOWN )
{
canvas.scrollToY( increment );
}
return true;
}