Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Point


        if (tooltipText != null) {
            Tooltip tooltip = new Tooltip(new Label(tooltipText));

            Display display = component.getDisplay();
            Point location = component.mapPointToAncestor(display, x, y);

            // Ensure that the tooltip stays on screen
            int tooltipX = location.x + 16;
            int tooltipY = location.y;
View Full Code Here


    }

    public void activeChanged(MenuBar.Item menuBarItem) {
        if (menuBarItem.isActive()) {
            Display display = menuBarItem.getDisplay();
            Point menuBarItemLocation = menuBarItem.mapPointToAncestor(display, 0, getHeight());

            // TODO Ensure that the popup remains within the bounds of the display

            menuPopup.setLocation(menuBarItemLocation.x, menuBarItemLocation.y);
            menuPopup.open(menuBarItem.getWindow());
View Full Code Here

    public int getY() {
        return y;
    }

    public Point getLocation() {
        return new Point(x, y);
    }
View Full Code Here

    public void setY(int y) {
        this.y = y;
    }

    public Point getOffset() {
        return new Point(x, y);
    }
View Full Code Here

        this.x = x;
        this.y = y;
    }

    public Point getOrigin() {
        return new Point(x, y);
    }
View Full Code Here

        if (Mouse.getCapturer() == component) {
            Frame frame = (Frame)getComponent();
            Display display = frame.getDisplay();

            Point location = frame.mapPointToAncestor(display, x, y);

            // Pretend that the mouse can't move off screen (off the display)
            location = new Point(Math.min(Math.max(location.x, 0), display.getWidth() - 1),
                Math.min(Math.max(location.y, 0), display.getHeight() - 1));

            if (dragOffset != null) {
                // Move the frame
                frame.setLocation(location.x - dragOffset.x, location.y - dragOffset.y);
View Full Code Here

        if (button == Mouse.Button.LEFT
            && !maximized) {
            Bounds titleBarBounds = titleBarTablePane.getBounds();

            if (titleBarBounds.contains(x, y)) {
                dragOffset = new Point(x, y);
                Mouse.capture(component);
            } else {
                Bounds resizeHandleBounds = resizeHandle.getBounds();

                if (resizeHandleBounds.contains(x, y)) {
                    resizeOffset = new Point(getWidth() - x, getHeight() - y);
                    Mouse.capture(component);
                }
            }
        }
View Full Code Here

                Slider slider = (Slider)TerraSliderSkin.this.getComponent();
                if (slider.getOrientation() == Orientation.HORIZONTAL) {
                    int sliderWidth = slider.getWidth();
                    int thumbWidth = thumb.getWidth();

                    Point sliderLocation = thumb.mapPointToAncestor(slider, x, y);
                    int sliderX = sliderLocation.x;

                    int minX = dragOffset.x;
                    if (sliderX < minX) {
                        sliderX = minX;
                    }

                    int maxX = (sliderWidth - thumbWidth) + dragOffset.x;
                    if (sliderX > maxX) {
                        sliderX = maxX;
                    }

                    float ratio = (float)(sliderX - dragOffset.x) / (sliderWidth - thumbWidth);

                    int start = slider.getStart();
                    int end = slider.getEnd();

                    int value = (int)(start + (end - start) * ratio);
                    slider.setValue(value);
                } else {
                    int sliderHeight = slider.getHeight();
                    int thumbHeight = thumb.getHeight();

                    Point sliderLocation = thumb.mapPointToAncestor(slider, x, y);
                    int sliderY = sliderLocation.y;

                    int minY = dragOffset.y;
                    if (sliderY < minY) {
                        sliderY = minY;
View Full Code Here

            boolean consumed = super.mouseDown(component, button, x, y);

            component.requestFocus();

            if (button == Mouse.Button.LEFT) {
                dragOffset = new Point(x, y);
                Mouse.capture(component);
                repaintComponent();

                consumed = true;
            }
View Full Code Here

        @Override
        public void run() {
            MenuPopup menuPopup = (MenuPopup)getComponent();
            Display display = menuPopup.getDisplay();

            Point location = menuPopup.getLocation();
            Dimensions size = menuPopup.getSize();

            int x = location.x;
            if (x + size.width > display.getWidth()) {
                x -= size.width;
View Full Code Here

TOP

Related Classes of org.apache.pivot.wtk.Point

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.