AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
rectContainsRect (Rectangle rect1, Rectangle rect2) yoix.graphics
rectContainsRect (Rectangle rect1, Number x, Number y, Number width, Number height)  
 
Returns 1 if rectangle rect1 completely contains rectangle rect2 and 0 if it doesn't. The second rectangle can also be supplied by giving its width, height, and coordinates of its upper left corner (x,y).
 
 Example:   The program,
import yoix.*.*;

JFrame frame = {
    Array layout = {
        new JButton {
            String text = "Contained On Screen?";

            actionPerformed(e) {
                Rectangle rect;
                Point     corner;
                int       contained;

                corner = getLocationOnScreen(this);
                contained = rectContainsRect(
                    VM.screen.bounds,
                    corner.x, corner.y, size.width, size.height
                );

                if (contained)
                    printf("Button is completely contained\n");
                else printf("Button is not completely contained\n");
            }
        }, CENTER,
    };
};

frame.visible = TRUE;
fills a frame with a button that tells you if it's completely contained on your screen whenever it's pressed.
 
 See Also:   clearRect, copyArea, drawArc, drawImage, drawLine, drawOval, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawString, fillArc, fillOval, fillPolygon, fillRect, fillRoundRect, pointInPolygon, pointInRect, rectIntersectionRect, rectIntersectsRect, rectUnionRect, stringBounds, stringWidth

 

Yoix is a registered trademark of AT&T Inc.