Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.MenuBar


        // Include title bar height plus top/bottom title bar borders
        preferredHeight += titleBarSize.height + 2;

        // Include menu bar size
        MenuBar menuBar = frame.getMenuBar();
        if (menuBar != null) {
            Dimensions preferredMenuBarSize = menuBar.getPreferredSize();

            preferredWidth = Math.max(preferredWidth, preferredMenuBarSize.width);
            preferredHeight += preferredMenuBarSize.height;
        }
View Full Code Here


                && !maximized
                && (frame.isPreferredWidthSet()
                    || frame.isPreferredHeightSet()));

            // Size/position menu bar
            MenuBar menuBar = frame.getMenuBar();
            if (menuBar != null
                && menuBar.isVisible()) {
                menuBar.setLocation(clientX, clientY);
                menuBar.setSize(clientWidth, menuBar.getPreferredHeight());

                clientY += menuBar.getHeight();
            }

            // Size/position content
            Component content = frame.getContent();
            if (content != null) {
                int contentX = clientX + padding.left;
                int contentY = clientY + padding.top;
                int contentWidth = Math.max(clientWidth - (padding.left + padding.right), 0);
                int contentHeight = Math.max(clientHeight - (clientY + padding.top + padding.bottom) + (showContentBevel ? 1 : 0), 0);

                content.setLocation(contentX, contentY);
                content.setSize(contentWidth, contentHeight);
            }
        } else {
            titleBarTablePane.setVisible(false);
            resizeHandle.setVisible(false);

            // Size/position menu bar
            int clientY = 0;
            MenuBar menuBar = frame.getMenuBar();
            if (menuBar != null
                && menuBar.isVisible()) {
                menuBar.setLocation(0, clientY);
                menuBar.setSize(width, menuBar.getPreferredHeight());

                clientY += menuBar.getHeight();
            }

            Component content = frame.getContent();
            if (content != null) {
                content.setLocation(padding.left, clientY + padding.top);
View Full Code Here

    @Override
    public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
        boolean consumed = super.keyPressed(component, keyCode, keyLocation);

        Frame frame = (Frame)component;
        MenuBar menuBar = frame.getMenuBar();

        if (menuBar != null
            && keyCode == Keyboard.KeyCode.SPACE
            && Keyboard.isPressed(Keyboard.Modifier.ALT)) {
            MenuBar.Item activeItem = menuBar.getActiveItem();
            MenuBar.ItemSequence items = menuBar.getItems();

            if (activeItem == null
                && items.getLength() > 0) {
                items.get(0).setActive(true);
View Full Code Here

    @Override
    public void mouseOver(Component component) {
        super.mouseOver(component);

        MenuBar.Item menuBarItem = (MenuBar.Item)getComponent();
        MenuBar menuBar = (MenuBar)menuBarItem.getParent();

        if (menuBar.getActiveItem() != null) {
            menuBarItem.setActive(true);
        }
    }
View Full Code Here

            // from height constraint
            height -= titleBarSize.height + 2;
        }

        // Include menu bar width
        MenuBar menuBar = frame.getMenuBar();
        if (menuBar != null) {
            Dimensions menuBarSize = menuBar.getPreferredSize();
            preferredWidth = Math.max(preferredWidth, menuBarSize.width);

            if (height != -1) {
                // Subtract menu bar height from height constraint
                height -= menuBarSize.height;
View Full Code Here

        // Include title bar height plus top/bottom title bar borders
        preferredHeight += titleBarTablePane.getPreferredHeight() + 2;

        // Include menu bar height
        MenuBar menuBar = frame.getMenuBar();
        if (menuBar != null) {
            preferredHeight += menuBar.getPreferredHeight();
        }

        Component content = frame.getContent();
        if (content != null) {
            if (width != -1) {
View Full Code Here

        // Include title bar height plus top/bottom title bar borders
        preferredHeight += titleBarSize.height + 2;

        // Include menu bar size
        MenuBar menuBar = frame.getMenuBar();
        if (menuBar != null) {
            Dimensions preferredMenuBarSize = menuBar.getPreferredSize();

            preferredWidth = Math.max(preferredWidth, preferredMenuBarSize.width);
            preferredHeight += preferredMenuBarSize.height;
        }
View Full Code Here

                && !maximized
                && (frame.isPreferredWidthSet()
                    || frame.isPreferredHeightSet()));

            // Size/position menu bar
            MenuBar menuBar = frame.getMenuBar();
            if (menuBar != null
                && menuBar.isVisible()) {
                menuBar.setLocation(clientX, clientY);
                menuBar.setSize(clientWidth, menuBar.getPreferredHeight());

                clientY += menuBar.getHeight();
            }

            // Size/position content
            Component content = frame.getContent();
            if (content != null) {
                int contentX = clientX + padding.left;
                int contentY = clientY + padding.top;
                int contentWidth = Math.max(clientWidth - (padding.left + padding.right), 0);
                int contentHeight = Math.max(clientHeight - (clientY + padding.top + padding.bottom) + (showContentBevel ? 1 : 0), 0);

                content.setLocation(contentX, contentY);
                content.setSize(contentWidth, contentHeight);
            }
        } else {
            titleBarTablePane.setVisible(false);
            resizeHandle.setVisible(false);

            // Size/position menu bar
            int clientY = 0;
            MenuBar menuBar = frame.getMenuBar();
            if (menuBar != null
                && menuBar.isVisible()) {
                menuBar.setLocation(0, clientY);
                menuBar.setSize(width, menuBar.getPreferredHeight());

                clientY += menuBar.getHeight();
            }

            Component content = frame.getContent();
            if (content != null) {
                content.setLocation(padding.left, clientY + padding.top);
View Full Code Here

    @Override
    public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation) {
        boolean consumed = super.keyPressed(component, keyCode, keyLocation);

        Frame frame = (Frame)component;
        MenuBar menuBar = frame.getMenuBar();

        if (menuBar != null
            && keyCode == Keyboard.KeyCode.SPACE
            && Keyboard.isPressed(Keyboard.Modifier.ALT)) {
            MenuBar.Item activeItem = menuBar.getActiveItem();
            MenuBar.ItemSequence items = menuBar.getItems();

            if (activeItem == null
                && items.getLength() > 0) {
                items.get(0).setActive(true);
View Full Code Here

    @Override
    public void mouseOver(Component component) {
        super.mouseOver(component);

        MenuBar.Item menuBarItem = (MenuBar.Item)getComponent();
        MenuBar menuBar = (MenuBar)menuBarItem.getParent();

        if (menuBar.getActiveItem() != null) {
            menuBarItem.setActive(true);
        }
    }
View Full Code Here

TOP

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

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.