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


Java JComponent.setAutoscrolls方法代码示例

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


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

示例1: dragGestureRecognized

import javax.swing.JComponent; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void dragGestureRecognized(DragGestureEvent dge) {
    JComponent c = (JComponent)dge.getComponent();
    DefaultTransferHandler th
        = (DefaultTransferHandler)c.getTransferHandler();
    Transferable t = th.createTransferable(c);
    if (t == null) {
        logger.warning("Unable to create transferable for: " + dge);
        th.exportDone(c, null, NONE);
        return;
    }

    this.scrolls = c.getAutoscrolls();
    c.setAutoscrolls(false);
    try {
        Cursor cursor = getCursor(c);
        dge.startDrag(cursor, t, this);
    } catch (RuntimeException re) {
        c.setAutoscrolls(this.scrolls);
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:24,代码来源:DefaultTransferHandler.java

示例2: dragDropEnd

import javax.swing.JComponent; //导入方法依赖的package包/类
/**
 * as the operation completes
 */
@Override
public void dragDropEnd(DragSourceDropEvent dsde) {
	DragSourceContext dsc = dsde.getDragSourceContext();
	JComponent c = (JComponent) dsc.getComponent();
	if (dsde.getDropSuccess()) {
		((AbstractPatchedTransferHandler) c.getTransferHandler()).exportDone(c, dsc.getTransferable(),
				dsde.getDropAction());
	} else {
		((AbstractPatchedTransferHandler) c.getTransferHandler()).exportDone(c, dsc.getTransferable(), NONE);
	}
	c.setAutoscrolls(scrolls);
	fireDragEnded();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:17,代码来源:AbstractPatchedTransferHandler.java

示例3: dragDropEnd

import javax.swing.JComponent; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void dragDropEnd(DragSourceDropEvent dsde) {
    DragSourceContext dsc = dsde.getDragSourceContext();
    JComponent c = (JComponent)dsc.getComponent();

    if (dsde.getDropSuccess()) {
        ((DefaultTransferHandler)c.getTransferHandler()).exportDone(c,
            dsc.getTransferable(), dsde.getDropAction());
    } else {
        ((DefaultTransferHandler)c.getTransferHandler()).exportDone(c,
            null, NONE);
    }
    c.setAutoscrolls(scrolls);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:17,代码来源:DefaultTransferHandler.java

示例4: setupForDragging

import javax.swing.JComponent; //导入方法依赖的package包/类
private void setupForDragging(MouseEvent e)
{
	source.addMouseMotionListener( this );

	//  Determine the component that will ultimately be moved

	if (destinationComponent != null)
	{
		destination = destinationComponent;
	}
	else if (destinationClass == null)
	{
		destination = source;
	}
	else  //  forward events to destination component
	{
		destination = SwingUtilities.getAncestorOfClass(destinationClass, source);
	}

	pressed = e.getLocationOnScreen();
	location = destination.getLocation();

	if (changeCursor)
	{
		originalCursor = source.getCursor();
		source.setCursor( Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR) );
	}

	//  Making sure autoscrolls is false will allow for smoother dragging of
	//  individual components

	if (destination instanceof JComponent)
	{
		JComponent jc = (JComponent)destination;
		autoscrolls = jc.getAutoscrolls();
		jc.setAutoscrolls( false );
	}
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:39,代码来源:ComponentMover.java


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