Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Display


        super.install(component);
    }

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

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

            if (window.isVisible()) {
                if (window.isMaximized()) {
                    window.setSize(display.getSize());
                } else {
                    Dimensions preferredSize = window.getPreferredSize();

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


        Menu.Item menuItem = (Menu.Item)getComponent();
        Menu menu = menuItem.getMenu();

        if (menu != null
            && !menuPopup.isOpen()) {
            Display display = menuItem.getDisplay();
            Point location = menuItem.mapPointToAncestor(display, getWidth(), 0);

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

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

                    listViewBorder.setPreferredHeight(-1);
                }
            }
        }

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

        dropShadowDecorator.setShadowOpacity(DropShadowDecorator.DEFAULT_SHADOW_OPACITY);

        TextInput textInput = suggestionPopup.getTextInput();
        textInput.getComponentStateListeners().add(textInputStateListener);
        textInput.getComponentKeyListeners().add(textInputKeyListener);

        // Size and position the popup
        Point location = textInput.mapPointToAncestor(textInput.getDisplay(), 0, 0);
        window.setLocation(location.x, location.y + textInput.getHeight() - 1);
        window.setMinimumWidth(textInput.getWidth());
        window.setMaximumHeight(display.getHeight() - window.getY());
    }
View Full Code Here

        String tooltipText = component.getTooltipText();

        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;

            int tooltipHeight = tooltip.getPreferredHeight();
            if (tooltipY + tooltipHeight > display.getHeight()) {
                tooltipY -= tooltipHeight;
            }

            tooltip.setLocation(tooltipX, tooltipY);
            tooltip.open(component.getWindow());
View Full Code Here

        repaintComponent();
    }

    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);
View Full Code Here

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

        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);
            } else {
View Full Code Here

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

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

        MenuPopup menuPopup = (MenuPopup)window;
        Menu menu = menuPopup.getMenu();
        if (menu != null) {
            Menu.Item activeItem = menu.getActiveItem();
View Full Code Here

    MenuPopupStateListener {
    private class RepositionCallback implements Runnable {
        @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;
            }

            int y = location.y;
            if (y + size.height > display.getHeight()) {
                y-= size.height;
            }

            menuPopup.setLocation(x, y);
        }
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.getContainerMouseListeners().add(displayMouseListener);
        display.getComponentKeyListeners().add(displayKeyListener);
    }
View Full Code Here

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

                Display display = menuButton.getDisplay();

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

                Dimensions displaySize = display.getSize();
                menuPopup.setPreferredSize(-1, -1);
                Dimensions popupSize = menuPopup.getPreferredSize();
                int popupWidth = Math.max(popupSize.width, menuButton.getWidth());
                int popupHeight = popupSize.height;
View Full Code Here

TOP

Related Classes of org.apache.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.