Package java.awt

Examples of java.awt.Rectangle.translate()


    }

    @Override
    public Rectangle2D getBounds2D(int resolution) {
        Rectangle r = super.getBounds2D(resolution).getBounds();
        r.translate(getModelPaintLocation(resolution).x - getModelDefaultPaintLocation(resolution).x,
                getModelPaintLocation(resolution).y - getModelDefaultPaintLocation(resolution).y);
        return r;
    }

    public Ellipse2D getBoundsCircle(int resolution) {
View Full Code Here


                            if (player.getGui().isDebugEnabled()) {
                                if (isDebugEnabled()) {
                                    System.out.println("collisions rect tx : " + resTx + " location : " + location);
                                }
                            }
                            locR.translate(location.x, location.y);
                            boundsVLoc.add(locR);
                        }
                    }
                    bounds = boundsVLoc.toArray(bounds);
                }
View Full Code Here

        Rectangle r = (Rectangle)rect.clone();

        if (r.intersects(getBounds()) == false)
            return null;
        r = r.intersection(getBounds());
        r.translate(-getMinX(), - getMinY());

        Raster ret = bi.getData(r);
        return ret.createTranslatedChild(ret.getMinX()+getMinX(),
                                         ret.getMinY()+getMinY());
    }
View Full Code Here

      vpSelectionColors.add( doc.getSelectedTracks().contains( t ) ? colrSelection : colrSelection2 );

      for( int i = 0; i < doc.getActiveTransmitters().size(); i++ ) {
//        r    = new Rectangle( waveView.rectForChannel( ch ));
        r    = new Rectangle( waveView.rectForTransmitter( i ));
        r.translate( x, y );
        t    = (Track) doc.getActiveTransmitters().get( i );
        vpSelections.add( r );
        vpSelectionColors.add( doc.getSelectedTracks().contains( t ) ? colrSelection : colrSelection2 );
      }
    }
View Full Code Here

            setComposedText();
            Rectangle rect;
            Point location = jta.getLocationOnScreen();
            for (int i = 0; i < 7; i++) {
                rect = jta.modelToView(i);
                rect.translate(location.x, location.y);
                assertNull(imr.getLocationOffset(rect.x, rect.y));
            }
            for (int i = 7; i < 13; i++) {
                rect = jta.modelToView(i);
                rect.translate(location.x, location.y);
View Full Code Here

                rect.translate(location.x, location.y);
                assertNull(imr.getLocationOffset(rect.x, rect.y));
            }
            for (int i = 7; i < 13; i++) {
                rect = jta.modelToView(i);
                rect.translate(location.x, location.y);
                assertEquals(TextHitInfo.afterOffset(i - 7), imr.getLocationOffset(rect.x,
                        rect.y));
            }
        } catch (BadLocationException e) {
        }
View Full Code Here

        try {
            setComposedText();
            int pos = 7;
            Rectangle rect = jta.modelToView(pos);
            Point location = jta.getLocationOnScreen();
            rect.translate(location.x, location.y);
            for (int i = 0; i < 10; i++) {
                assertEquals(rect, imr.getTextLocation(TextHitInfo.beforeOffset(i)));
                assertEquals(rect, imr.getTextLocation(TextHitInfo.afterOffset(i)));
            }
            iter = getIterator("klnoprst", putSegmentAttribute(map, Color.BLACK));
View Full Code Here

            iter = getIterator("klnoprst", putSegmentAttribute(map, Color.BLACK));
            ime = getTextEvent(iter, 5, TextHitInfo.afterOffset(0), TextHitInfo.afterOffset(0));
            jta.processInputMethodEvent(ime);
            pos = 12;
            rect = jta.modelToView(pos);
            rect.translate(location.x, location.y);
            for (int i = 0; i < 10; i++) {
                assertEquals(rect, imr.getTextLocation(TextHitInfo.beforeOffset(i)));
                assertEquals(rect, imr.getTextLocation(TextHitInfo.afterOffset(i)));
            }
        } catch (BadLocationException e) {
View Full Code Here

  public boolean contain(Point p) {

    Point org = info.getViewPosition();

    Rectangle rect = new Rectangle(x, y, icon.getWidth(), icon.getHeight());
    rect.translate(org.x, org.y);

    return rect.contains(p);
  }
}
View Full Code Here

        int descent = mets.getDescent();
        int height = ascent + descent;

        Rectangle ret = new Rectangle(x, y, width, height);
        switch (halign) {
            case H_CENTER: ret.translate(-(width / 2), 0); break;
            case H_RIGHT:  ret.translate(-width, 0); break;
            default: ;
        }
        switch (valign) {
            case V_TOP:      break;
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.