javax.swing.JComponent#getAutoscrolls ( )源码实例Demo

下面列出了javax.swing.JComponent#getAutoscrolls ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: freecol   文件: DefaultTransferHandler.java
/**
 * {@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);
    }
}
 
源代码2 项目: nanoleaf-desktop   文件: ComponentResizer.java
@Override
public void mousePressed(MouseEvent e)
{
	//	The mouseMoved event continually updates this variable

	if (direction == 0) return;

	//  Setup for resizing. All future dragging calculations are done based
	//  on the original bounds of the component and mouse pressed location.

	resizing = true;

	Component source = e.getComponent();
	pressed = e.getPoint();
	SwingUtilities.convertPointToScreen(pressed, source);
	bounds = source.getBounds();

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

	if (source instanceof JComponent)
	{
		JComponent jc = (JComponent)source;
		autoscrolls = jc.getAutoscrolls();
		jc.setAutoscrolls( false );
	}
}
 
源代码3 项目: 07kit   文件: ComponentResizer.java
@Override
public void mousePressed(MouseEvent e) {
    //  The mouseMoved event continually updates this variable

    if (direction == 0) {
        return;
    }

    //  Setup for resizing. All future dragging calculations are done based
    //  on the original bounds of the component and mouse pressed location.

    resizing = true;

    Component source = e.getComponent();
    pressed = e.getPoint();
    SwingUtilities.convertPointToScreen(pressed, source);
    bounds = source.getBounds();

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

    if (source instanceof JComponent) {
        JComponent jc = (JComponent) source;
        autoscrolls = jc.getAutoscrolls();
        jc.setAutoscrolls(false);
    }
}
 
源代码4 项目: 07kit   文件: ComponentMover.java
private void setupForDragging(MouseEvent e) {
        source.addMouseMotionListener(this);
        potentialDrag = true;

        //  Determine the component that will ultimately be moved

        if (destinationComponent != null) {
            destination = destinationComponent;
        }

//        if (destination instanceof MainView) {
//            final MainView gui = (MainView) destination;
//            if (gui.isMaximized()) {
//                return;
//            }
//        }

        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);
        }
    }
 
源代码5 项目: mars-sim   文件: ComponentMover.java
private void setupForDragging(MouseEvent e)
{
	source.addMouseMotionListener( this );
	potentialDrag = true;

	//  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 );
	}
}
 
源代码6 项目: SikuliX1   文件: ComponentMover.java
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();

      if (destination instanceof Visual){
         location = ((Visual) destination).getActualLocation();
      }else{
         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 );

      }

   }