Package charva.awt

Examples of charva.awt.Rectangle


        /*
         * Get the bounding rectangle of the child viewport, relative to the
         * top left corner of the JScrollPane.
         */
        Rectangle viewport = _childViewport.getBounds();
        //Dimension viewportExtent = _childViewport.getExtentSize();

        Point viewPosition = _childViewport.getViewPosition();
        Point headerPosition = null;
        if (_headerViewport != null)
                headerPosition = _headerViewport.getViewPosition();

        /*
         * If the limit is inside the viewport, the component doesn't need to
         * be scrolled. First do the left/right scrolling.
         */
        if (limit.x > viewport.getRight()) {
            if ((direction == ScrollEvent.LEFT
                    || direction == ScrollEvent.UP_LEFT || direction == ScrollEvent.DOWN_LEFT)) {

                viewPosition.x -= (limit.x - viewport.getRight());
                if (_headerViewport != null)
                        headerPosition.x -= (limit.x - viewport.getRight());
            } else if (direction == ScrollEvent.RIGHT
                    || direction == ScrollEvent.UP_RIGHT
                    || direction == ScrollEvent.DOWN_RIGHT) {

                viewPosition.x += (viewport.getLeft() - limit.x);
                if (_headerViewport != null)
                        headerPosition.x += (viewport.getLeft() - limit.x);
            }
        } else if (limit.x < viewport.getLeft()) {
            if (direction == ScrollEvent.RIGHT
                    || direction == ScrollEvent.UP_RIGHT
                    || direction == ScrollEvent.DOWN_RIGHT) {

                viewPosition.x += (viewport.getLeft() - limit.x);
                if (_headerViewport != null)
                        headerPosition.x += (viewport.getLeft() - limit.x);
            } else if (direction == ScrollEvent.LEFT
                    || direction == ScrollEvent.UP_LEFT
                    || direction == ScrollEvent.DOWN_LEFT) {
                viewPosition.x -= (limit.x - viewport.getRight());
                if (_headerViewport != null)
                        headerPosition.x -= (limit.x - viewport.getRight());
            }
        }

        // Now do the up/down scrolling
        if (limit.y < viewport.getTop()
                && (direction == ScrollEvent.DOWN
                        || direction == ScrollEvent.DOWN_LEFT || direction == ScrollEvent.DOWN_RIGHT)) {

            viewPosition.y += (viewport.getTop() - limit.y);
        } else if (limit.y > viewport.getBottom()
                && (direction == ScrollEvent.UP
                        || direction == ScrollEvent.UP_LEFT || direction == ScrollEvent.UP_RIGHT)) {

            viewPosition.y -= (limit.y - viewport.getBottom());
        }

        _childViewport.setViewPosition(viewPosition);
        if (_headerViewport != null)
                _headerViewport.setViewPosition(headerPosition);
View Full Code Here


     * component. This must be called AFTER the size of the dialog has been
     * set, and the size and location of the specified component has been set.
     */
    public void setLocationRelativeTo(Component component_) {
        Dimension size = super.getSize(); // our own size
        Rectangle bounds = component_.getBounds(); // bounds of component
        int x = ((bounds.getLeft() + bounds.getRight()) / 2) - (size.width / 2);
        int y = ((bounds.getTop() + bounds.getBottom()) / 2)
                - (size.height / 2);
        super.setLocation(x, y);
    }
View Full Code Here

    /**
     * Returns the rectangle representing the area that needs to be
     * repainted in response to this event.
     */
    public Rectangle getUpdateRect() { return new Rectangle(_updateRect); }
View Full Code Here

  /* Get the absolute origin of this Viewport
   */
  Point origin = getLocationOnScreen();

  toolkit.setClipRect(new Rectangle(origin, getExtentSize()));
  _child.draw(toolkit);
  toolkit.resetClipRect();
    }
View Full Code Here

    public Dimension getViewSize() {
  return _child.getSize();
    }

    public Rectangle getBounds() {
  return new Rectangle(getLocation(), getExtentSize());
    }
View Full Code Here

TOP

Related Classes of charva.awt.Rectangle

Copyright © 2018 www.massapicom. 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.