Package pivot.wtk

Examples of pivot.wtk.Display


    @Override
    public void windowOpened(Window window) {
        super.windowOpened(window);

        Display display = window.getDisplay();
        display.getContainerMouseListeners().add(displayMouseListener);

        Component.getComponentClassListeners().add(this);
    }
View Full Code Here


    public boolean mouseMove(Component component, int x, int y) {
        boolean consumed = super.mouseMove(component, x, y);

        if (Mouse.getCapturer() == component) {
            Window window = (Window)getComponent();
            Display display = window.getDisplay();

            Point location = window.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 window
                window.setLocation(location.x - dragOffset.x, location.y - dragOffset.y);
            } else {
View Full Code Here

    @Override
    public void windowOpened(Window window) {
        super.windowOpened(window);

        // Add this as a display mouse and key listener
        Display display = window.getDisplay();
        display.getComponentMouseListeners().add(closeHandler);
        display.getComponentMouseButtonListeners().add(closeHandler);
        display.getComponentMouseWheelListeners().add(closeHandler);
        display.getComponentKeyListeners().add(closeHandler);
    }
View Full Code Here

            ListButton listButton = (ListButton)button;

            if (listButton.getListData().getLength() > 0) {
                // Determine the popup's location and preferred size, relative
                // to the button
                Display display = listButton.getDisplay();

                if (display != null) {
                    int width = getWidth();
                    int height = getHeight();

                    Component content = listViewPopup.getContent();

                    // Ensure that the popup remains within the bounds of the display
                    Point buttonLocation = listButton.mapPointToAncestor(display, 0, 0);

                    Dimensions displaySize = display.getSize();
                    Dimensions popupSize = content.getPreferredSize();
                    int popupHeight = popupSize.height;

                    int x = buttonLocation.x;
                    if (popupSize.width > width
View Full Code Here

        super.install(component);
    }

    public void layout() {
        Display display = (Display)getComponent();

        // Set all components to their preferred sizes
        for (Component component : display) {
            Window window = (Window)component;

            if (window.isDisplayable()) {
                if (window.isMaximized()) {
                    window.setLocation(0, 0);
                    window.setSize(display.getSize());
                } else {
                    Dimensions preferredSize = window.getPreferredSize();

                    if (window.getWidth() != preferredSize.width
                        || window.getHeight() != preferredSize.height) {
View Full Code Here

    @Override
    public boolean mouseMove(Component component, int x, int y) {
        boolean consumed = super.mouseMove(component, x, y);

        if (activeWindowFollowsMouse) {
            Display display = (Display)getComponent();

            Window window = (Window)display.getComponentAt(x, y);
            if (window != null
                && window.isEnabled()
                && !window.isAuxilliary()) {
                Window.setActiveWindow(window);
            }
View Full Code Here

        if (menu != null
            && !menuPopup.isOpen()) {
            // Determine the popup's location and preferred size, relative
            // to the menu item
            Display display = menuItem.getDisplay();
            Point menuItemLocation = menuItem.mapPointToAncestor(display, getWidth(), 0);

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

            menuPopup.setLocation(menuItemLocation.x, menuItemLocation.y);
View Full Code Here

    public boolean mouseMove(Component component, int x, int y) {
        boolean consumed = super.mouseMove(component, x, y);

        if (Mouse.getCapturer() == component) {
            Window window = (Window)getComponent();
            Display display = window.getDisplay();

            Point location = window.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 window
                window.setLocation(location.x - dragOffset.x, location.y - dragOffset.y);
            }
View Full Code Here

        } else {
            CalendarButton calendarButton = (CalendarButton)button;

            // Determine the popup's location and preferred size, relative
            // to the button
            Display display = calendarButton.getDisplay();

            if (display != null) {
                int width = getWidth();
                int height = getHeight();

                Component content = calendarPopup.getContent();

                // Ensure that the popup remains within the bounds of the display
                Point buttonLocation = calendarButton.mapPointToAncestor(display, 0, 0);

                Dimensions displaySize = display.getSize();
                Dimensions popupSize = content.getPreferredSize();
                int popupHeight = popupSize.height;

                int x = buttonLocation.x;
                if (popupSize.width > width
View Full Code Here

TOP

Related Classes of pivot.wtk.Display

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.