Package java.awt

Examples of java.awt.Point.translate()


            Point2D pos = evt.getPoint2D();
            AffineTransform transform = ua.getTransform();
            if (transform != null && !transform.isIdentity())
                transform.transform(pos, pos);
            Point screen = ua.getClientAreaLocationOnScreen();
            screen.translate((int)Math.floor(pos.getX()),
                             (int)Math.floor(pos.getY()));
            // compute screen coordinates
            GraphicsNode node = evt.getGraphicsNode();
            Element elmt = context.getElement(node);
            if (elmt == null) // should not appeared if binding on
View Full Code Here


      aboutMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          JDialog aboutDialog = getAboutDialog();
          aboutDialog.pack();
          Point loc = getJFrame().getLocation();
          loc.translate(20, 20);
          aboutDialog.setLocation(loc);
          aboutDialog.setVisible(true);
        }
      });
    }
View Full Code Here

                public void actionPerformed( ActionEvent e ) {

                    JDialog aboutDialog = getAboutDialog();
                    aboutDialog.pack();
                    Point loc = getJFrame().getLocation();
                    loc.translate( 20, 20 );
                    aboutDialog.setLocation( loc );
                    aboutDialog.setVisible( true );
                }
            } );
        }
View Full Code Here

    // Draw Arrows for targets
    List<UUID> targets = data.card.getTargets();
    if (targets != null) {
      Point parent = SwingUtilities.getRoot(data.component).getLocationOnScreen();
      Point me = new Point(data.locationOnScreen);
      me.translate(-parent.x, -parent.y);
      for (UUID uuid : targets) {
        //System.out.println("Getting play area panel for uuid: " + uuid);
       
        PlayAreaPanel p = session.getGame().getPlayers().get(uuid);
        if (p != null) {
View Full Code Here

        //System.out.println("Getting play area panel for uuid: " + uuid);
       
        PlayAreaPanel p = session.getGame().getPlayers().get(uuid);
        if (p != null) {
          Point target = p.getLocationOnScreen();
          target.translate(-parent.x, -parent.y);
          ArrowBuilder.addArrow((int)me.getX() + 35, (int)me.getY(), (int)target.getX() + 40, (int)target.getY() - 40, Color.red);
        } else {
          for (PlayAreaPanel pa : session.getGame().getPlayers().values()) {
            MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid);
            if (permanent != null) {
View Full Code Here

        } else {
          for (PlayAreaPanel pa : session.getGame().getPlayers().values()) {
            MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid);
            if (permanent != null) {
              Point target = permanent.getLocationOnScreen();
              target.translate(-parent.x, -parent.y);
              ArrowBuilder.addArrow((int)me.getX() + 35, (int)me.getY(), (int)target.getX() + 40, (int)target.getY() + 10, Color.red);
            }
          }
        }
      }
View Full Code Here

   
    // Draw Arrows for source
    if (data.card.isAbility()) {
      Point parent = SwingUtilities.getRoot(data.component).getLocationOnScreen();
      Point me = new Point(data.locationOnScreen);
      me.translate(-parent.x, -parent.y);
      UUID uuid = data.card.getParentId();
      for (PlayAreaPanel pa : session.getGame().getPlayers().values()) {
        MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid);
        if (permanent != null) {
          Point source = permanent.getLocationOnScreen();
View Full Code Here

      UUID uuid = data.card.getParentId();
      for (PlayAreaPanel pa : session.getGame().getPlayers().values()) {
        MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid);
        if (permanent != null) {
          Point source = permanent.getLocationOnScreen();
          source.translate(-parent.x, -parent.y);
          ArrowBuilder.addArrow((int)source.getX() + 40, (int)source.getY() + 10, (int)me.getX() + 35, (int)me.getY() + 20, Color.blue);
        }
      }
    }
   
View Full Code Here

   */
  public void scrollBy(final int x, final int y) {
    final JViewport mapViewport = (JViewport) getParent();
    if (mapViewport != null) {
      final Point currentPoint = mapViewport.getViewPosition();
      currentPoint.translate(x, y);
      if (currentPoint.getX() < 0) {
        currentPoint.setLocation(0, currentPoint.getY());
      }
      if (currentPoint.getY() < 0) {
        currentPoint.setLocation(currentPoint.getX(), 0);
View Full Code Here

      while (this.isRunning()) {
        final Point location = MouseInfo.getPointerInfo().getLocation();
        this.moveToTop();
        this.setText(location);
        location.translate(10, 10);
        this.setPosition(location);
        // approx. 27 updates/second
        Thread.sleep(35);
      }
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.