Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.MenuBar$MenuBarListenerList


        return new Dimensions(preferredWidth, preferredHeight);
    }

    @Override
    public void layout() {
        MenuBar menuBar = (MenuBar)getComponent();

        int height = getHeight();
        int itemX = 0;

        for (MenuBar.Item item : menuBar.getItems()) {
            if (item.isVisible()) {
                item.setSize(item.getPreferredWidth(height), height);
                item.setLocation(itemX, 0);

                itemX += item.getWidth() + spacing;
View Full Code Here


            }
        }

        // Update the image view
        MenuBar.Item menuBarItem = (MenuBar.Item)button;
        MenuBar menuBar = menuBarItem.getMenuBar();

        if (icon == null) {
            imageView.setVisible(false);
        } else {
            imageView.setVisible(true);
            imageView.setImage(icon);
            imageView.getStyles().put("opacity", button.isEnabled() ? 1.0f : 0.5f);
        }

        // Update the label
        label.setText(text);

        if (text == null) {
            label.setVisible(false);
        } else {
            label.setVisible(true);

            Font font = (Font)menuBar.getStyles().get("font");
            label.getStyles().put("font", font);

            Color color;
            if (button.isEnabled()) {
                if (highlighted) {
                    color = (Color)menuBar.getStyles().get("activeColor");
                } else {
                    color = (Color)menuBar.getStyles().get("color");
                }
            } else {
                color = (Color)menuBar.getStyles().get("disabledColor");
            }

            label.getStyles().put("color", color);
        }
    }
View Full Code Here

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

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

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

TOP

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

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.