Package java.awt

Examples of java.awt.Point.translate()


            if(isBeingRightClickDragged){
              isBeingRightClickDragged = false;
             
              //TODO: Do this more neatly or move to a better place
              Point p = evt.getPoint();
              p.translate(Event.this.getX(), Event.this.getY());
              Component c = getParent().getComponentAt(p);
              if(c != null && c instanceof VarDeclaration && c != Event.this){
                VarDeclaration var = (VarDeclaration)c;
                               
                // Check that the event and var are either both input or both output
View Full Code Here


        // Sets the drop offset so that the location in the transfer
        // handler reflects the actual mouse position
        handler.setOffset(new Point((int) graph.snap(dx / scale),
            (int) graph.snap(dy / scale)));
        pt.translate(dx, dy);

        // Shifts the preview so that overlapping parts do not
        // affect the centering
        if (transferBounds != null && dragImage != null)
        {
View Full Code Here

              .round((dragImage.getIconWidth() - 2 - transferBounds
                  .getWidth() * scale) / 2);
          dy = (int) Math
              .round((dragImage.getIconHeight() - 2 - transferBounds
                  .getHeight() * scale) / 2);
          pt.translate(-dx, -dy);
        }

        if (!handler.isLocalDrag() && previewBounds != null)
        {
          setPreviewBounds(new Rectangle(pt, previewBounds.getSize()));
View Full Code Here

    if (location != null)
    {
      location = convertPoint(location);
      Rectangle r = graphComponent.getViewport().getViewRect();
      location.translate(r.x, r.y);
    }

    // LATER: Fetch state of modifier keys from event or via global
    // key listener using Toolkit.getDefaultToolkit().addAWTEventListener(
    // new AWTEventListener() {...}, AWTEvent.KEY_EVENT_MASK). Problem
View Full Code Here

  private void dispatchEvent( MouseEvent me )
  {
    if( rect != null && rect.contains( me.getX(), me.getY() ) )
    {
      Point pt = me.getPoint();
      pt.translate( -offset, 0 );
      comp.setBounds( rect );
      comp.dispatchEvent( new MouseEvent( comp, me.getID(), me.getWhen(), me.getModifiers(), pt.x, pt.y, me
          .getClickCount(), me.isPopupTrigger(), me.getButton() ) );
      if( !comp.isValid() )
        container.repaint();
View Full Code Here

    public void testDragTo() {
        prepareToTestFloating();
        Point origin = new Point(1, 2);
        Point position1 = frame.getLocation();
        position1.translate(frame.getWidth() + 1, 0);
        toolBar.setFloatable(false);
        ui.dragTo(position1, origin);
        assertNull(ui.dragWindow);
        toolBar.setFloatable(true);
        ui.dragTo(position1, origin);
View Full Code Here

        ui.dragTo(position1, origin);
        assertNotNull(ui.dragWindow);
        assertTrue(ui.dragWindow.isVisible());
        Point dragWindowPosition1 = ui.dragWindow.getLocation();
        Point position2 = new Point(position1);
        position2.translate(1, 2);
        ui.dragTo(position2, origin);
        Point dragWindowPosition2 = ui.dragWindow.getLocation();
        position2.translate(-position1.x, -position1.y);
        dragWindowPosition2.translate(-dragWindowPosition1.x, -dragWindowPosition1.y);
        assertEquals(position2, dragWindowPosition2);
View Full Code Here

        Point position2 = new Point(position1);
        position2.translate(1, 2);
        ui.dragTo(position2, origin);
        Point dragWindowPosition2 = ui.dragWindow.getLocation();
        position2.translate(-position1.x, -position1.y);
        dragWindowPosition2.translate(-dragWindowPosition1.x, -dragWindowPosition1.y);
        assertEquals(position2, dragWindowPosition2);
    }

    public void testFloatAt() {
        prepareToTestFloating();
View Full Code Here

    public void testFloatAt() {
        prepareToTestFloating();
        Point origin = new Point(1, 2);
        Point position1 = frame.getLocation();
        position1.translate(frame.getWidth() + 1, 0);
        toolBar.setFloatable(false);
        ui.dragTo(position1, origin);
        ui.floatAt(position1, origin);
        assertNull(ui.floatingWindow);
        toolBar.setFloatable(true);
View Full Code Here

    public void testSetIsFloating() {
        prepareToTestFloating();
        Point origin = new Point(1, 2);
        Point position1 = frame.getLocation();
        position1.translate(frame.getWidth() + 1, 0);
        ui.dragTo(position1, origin);
        Container parent = toolBar.getParent();
        Object constraint = ((BorderLayout) parent.getLayout()).getConstraints(toolBar);
        ui.setFloatingLocation(position1.x, position1.y);
        ui.setFloating(true, null);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.