Package com.ardor3d.extension.ui

Examples of com.ardor3d.extension.ui.UIButton


        tfName.setText("player1");
        tfName.setLayoutData(GridLayoutData.WrapAndGrow);
        final UILabel lPassword = new UILabel("Password");
        final UIPasswordField tfPassword = new UIPasswordField();
        tfPassword.setLayoutData(GridLayoutData.WrapAndGrow);
        final UIButton btLogin = new UIButton("login");
        btLogin.addActionListener(new ActionListener() {
            public void actionPerformed(final ActionEvent event) {
                System.out.println("login as user: " + tfName.getText() + " password: " + tfPassword.getText());
            }
        });
        pLogin.add(lHeader);
View Full Code Here


        historyArea.setEditable(false);
        final UIScrollPanel scrollArea = new UIScrollPanel(historyArea);
        scrollArea.setLayoutData(BorderLayoutData.CENTER);
        final UITextField chatField = new UITextField();
        chatField.setLayoutData(BorderLayoutData.CENTER);
        final UIButton chatButton = new UIButton("SAY");
        chatButton.setLayoutData(BorderLayoutData.EAST);

        final ActionListener actionListener = new ActionListener() {
            public void actionPerformed(final ActionEvent event) {
                applyChat(historyArea, chatField);
            }
        };
        chatButton.addActionListener(actionListener);
        chatField.addActionListener(actionListener);

        bottomPanel.add(chatField);
        bottomPanel.add(chatButton);
View Full Code Here

        final UIPanel panel = new UIPanel();
        panel.setForegroundColor(ColorRGBA.DARK_GRAY);
        panel.setLayout(new BorderLayout());

        final UIButton button = new UIButton("Button A");
        final Texture tex = TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear,
                false);
        button.setIcon(new SubTex(tex));
        button.setIconDimensions(new Dimension(26, 26));
        button.setGap(10);
        button.setLayoutData(BorderLayoutData.NORTH);
        button.setTooltipText("This is a tooltip!");
        panel.add(button);

        final RowLayout rowLay = new RowLayout(false, false, false);
        final UIPanel centerPanel = new UIPanel(rowLay);
        centerPanel.setLayoutData(BorderLayoutData.CENTER);
View Full Code Here

     * @param selected
     *            true if this button is to be selected and all others in the group should be de-selected.
     */
    public void setSelected(final UIButton button, final boolean selected) {
        if (selected && button != null && button != _selected) {
            final UIButton oldSelection = _selected;
            _selected = button;
            if (oldSelection != null) {
                oldSelection.setSelected(false);
            }
            button.setSelected(true);
        }
    }
View Full Code Here

                titleBar.getTitleLabel().setMargin(new Insets(0, 5, 0, 0));
                titleBar.getTitleLabel().setForegroundColor(ColorRGBA.BLACK);

                // CLOSE BUTTON
                {
                    final UIButton closeButton = titleBar.getCloseButton();
                    if (closeButton != null) {
                        closeButton.setButtonText("");
                        closeButton.setButtonIcon(new SubTex(_sharedTex, 94, 76, 16, 16));
                        closeButton.getPressedState().setIcon(new SubTex(_sharedTex, 94, 94, 16, 16));
                        for (final UIState state : closeButton.getStates()) {
                            state.setBackdrop(new EmptyBackdrop());
                            state.setBorder(new EmptyBorder());
                            state.setPadding(new Insets(0, 0, 0, 0));
                            state.setMargin(new Insets(1, 1, 1, 1));
                        }
                        closeButton.refreshState();
                        closeButton.updateMinimumSizeFromContents();
                        closeButton.compact();
                        closeButton
                                .setMaximumContentSize(closeButton.getContentWidth(), closeButton.getContentHeight());
                    }
                }

                // MINIMIZE BUTTON
                {
                    final UIButton minimizeButton = titleBar.getMinimizeButton();
                    if (minimizeButton != null) {
                        minimizeButton.setButtonText("");
                        minimizeButton.setButtonIcon(new SubTex(_sharedTex, 113, 76, 16, 16));
                        minimizeButton.getPressedState().setIcon(new SubTex(_sharedTex, 113, 94, 16, 16));
                        for (final UIState state : minimizeButton.getStates()) {
                            state.setBackdrop(new EmptyBackdrop());
                            state.setBorder(new EmptyBorder());
                            state.setPadding(new Insets(0, 0, 0, 0));
                            state.setMargin(new Insets(1, 1, 1, 1));
                        }
                        minimizeButton.refreshState();
                        minimizeButton.updateMinimumSizeFromContents();
                        minimizeButton.compact();
                        minimizeButton.setMaximumContentSize(minimizeButton.getContentWidth(), minimizeButton
                                .getContentHeight());
                    }
                }

                // EXPAND BUTTON
                {
                    final UIButton expandButton = titleBar.getExpandButton();
                    if (expandButton != null) {
                        expandButton.setButtonText("");
                        expandButton.setButtonIcon(new SubTex(_sharedTex, 132, 76, 16, 16));
                        expandButton.getPressedState().setIcon(new SubTex(_sharedTex, 132, 94, 16, 16));
                        for (final UIState state : expandButton.getStates()) {
                            state.setBackdrop(new EmptyBackdrop());
                            state.setBorder(new EmptyBorder());
                            state.setPadding(new Insets(0, 0, 0, 0));
                            state.setMargin(new Insets(1, 1, 1, 1));
                        }
                        expandButton.refreshState();
                        expandButton.updateMinimumSizeFromContents();
                        expandButton.compact();
                        expandButton.setMaximumContentSize(expandButton.getContentWidth(), expandButton
                                .getContentHeight());
                    }
                }

                // MINIMIZE BUTTON
                {
                    final UIButton helpButton = titleBar.getHelpButton();
                    if (helpButton != null) {
                        helpButton.setButtonText("");
                        helpButton.setButtonIcon(new SubTex(_sharedTex, 151, 76, 16, 16));
                        helpButton.getPressedState().setIcon(new SubTex(_sharedTex, 151, 94, 16, 16));
                        for (final UIState state : helpButton.getStates()) {
                            state.setBackdrop(new EmptyBackdrop());
                            state.setBorder(new EmptyBorder());
                            state.setPadding(new Insets(0, 0, 0, 0));
                            state.setMargin(new Insets(1, 1, 1, 1));
                        }
                        helpButton.refreshState();
                        helpButton.updateMinimumSizeFromContents();
                        helpButton.compact();
                        helpButton.setMaximumContentSize(helpButton.getContentWidth(), helpButton.getContentHeight());
                    }
                }
            }
        }

        // BASE PANEL
        {
            final UIPanel base = component.getBasePanel();

            base.setMargin(new Insets(0, 0, 0, 0));
            base.setPadding(new Insets(0, 0, 0, 0));

            final UIBorder border = new ImageBorder(
            // left
                    new SubTex(_sharedTex, 4, 17, 6, 29),
                    // right
                    new SubTex(_sharedTex, 30, 17, 6, 29),
                    // top
                    new SubTex(_sharedTex, 0, 0, 0, 0),
                    // bottom
                    new SubTex(_sharedTex, 10, 46, 20, 7),
                    // top left
                    null,
                    // top right
                    null,
                    // bottom left
                    new SubTex(_sharedTex, 4, 46, 6, 7),
                    // bottom right
                    new SubTex(_sharedTex, 30, 46, 6, 7));
            base.setBorder(border);
            final ColorRGBA top = new ColorRGBA(210 / 255f, 210 / 255f, 210 / 255f, 1);
            final ColorRGBA bottom = new ColorRGBA(244 / 255f, 244 / 255f, 244 / 255f, 1);
            final GradientBackdrop grad = new GradientBackdrop(top, top, bottom, bottom);
            base.setBackdrop(grad);
        }

        // STATUS BAR
        {
            final UIFrameStatusBar statusBar = component.getStatusBar();
            // Make sure exists and is attached
            if (statusBar != null && statusBar.getParent() == component.getBasePanel()) {
                statusBar.setLocalComponentHeight(12);
                statusBar.setMaximumContentHeight(statusBar.getContentHeight());

                final UIButton resize = statusBar.getResizeButton();
                if (resize != null && resize.getParent() == statusBar) {
                    for (final UIState state : resize.getStates()) {
                        state.setBackdrop(new EmptyBackdrop());
                        state.setBorder(new EmptyBorder());
                        state.setPadding(new Insets(0, 0, 0, 0));
                        state.setMargin(new Insets(0, 0, 0, 0));
                        state.setForegroundColor(ColorRGBA.GRAY);
                    }
                    resize.refreshState();
                    resize.updateMinimumSizeFromContents();
                    resize.setMinimumContentSize(resize.getContentWidth(), resize.getContentHeight());
                    resize.setMaximumContentSize(resize.getContentWidth(), resize.getContentHeight());
                }
            }
        }
    }
View Full Code Here

                    // bottom left
                    new SubTex(_sharedTex, 177, 21, 1, 4),
                    // bottom right
                    new SubTex(_sharedTex, 185, 21, 4, 4));

            final UIButton button = component.getOpenButton();
            button.setButtonText("");
            button.setButtonIcon(new SubTex(_sharedTex, 196, 12, 10, 9));
            button.getMouseOverState().setIcon(new SubTex(_sharedTex, 210, 12, 10, 9));
            button.setBorder(buttonBorder);
            button.setBackdrop(upBack);
            button.setMargin(new Insets(0, 0, 0, 0));
            button.setPadding(new Insets(0, 1, 0, 1));
            for (final UIState state : button.getStates()) {
                state.setBorder(buttonBorder);
                state.setBackdrop(upBack);
            }
        }

        // skin for menuitems
        {
            final EmptyBorder itemBorder = new EmptyBorder();
            final EmptyBackdrop itemBackdrop = new EmptyBackdrop();
            final SolidBackdrop overBackdrop = new SolidBackdrop(new ColorRGBA(50 / 255f, 50 / 255f, 200 / 255f, 1));
            component.setItemSkinCallback(new SkinningTask() {
                @Override
                public void skinComponent(final UIComponent c) {
                    c.setBorder(itemBorder);
                    c.setBackdrop(itemBackdrop);
                    c.setMargin(new Insets(0, 0, 0, 0));
                    c.setPadding(new Insets(0, 2, 0, 2));
                    c.setForegroundColor(ColorRGBA.BLACK);
                    if (c instanceof UIButton) {
                        final UIButton button = (UIButton) c;
                        button.setAlignment(Alignment.LEFT);
                        for (final UIState state : button.getStates()) {
                            state.setBorder(null);
                            state.setBackdrop(itemBackdrop);
                            state.setForegroundColor(ColorRGBA.BLACK);
                        }
                        final LabelState over = button.getMouseOverState();
                        over.setForegroundColor(ColorRGBA.WHITE);
                        over.setBackdrop(overBackdrop);
                    }
                }
            });
View Full Code Here

        border.setColor(new ColorRGBA(165 / 255f, 165 / 255f, 165 / 255f, 1f));
        component.setMargin(new Insets());
        component.setPadding(new Insets());
        component.setBorder(border);
        {
            final UIButton button = component.getBtTopLeft();
            button.setBackdrop(null);
            button.setBorder(new EmptyBorder());
            button.setPadding(new Insets(0, 0, 0, 0));
            button.setMargin(new Insets(0, 0, 0, 0));
            for (final UIState state : button.getStates()) {
                state.setBorder(null);
                state.setBackdrop(null);
            }
            button.setButtonText("");
            if (component.getOrientation() == Orientation.Horizontal) {
                button.setButtonIcon(new SubTex(_sharedTex, 130, 121, 16, 15));
                button.getMouseOverState().setIcon(new SubTex(_sharedTex, 130, 137, 16, 15));
            } else {
                button.setButtonIcon(new SubTex(_sharedTex, 97, 120, 15, 16));
                button.getMouseOverState().setIcon(new SubTex(_sharedTex, 113, 120, 15, 16));
            }
        }
        {
            final UIButton button = component.getBtBottomRight();
            button.setBackdrop(null);
            button.setBorder(new EmptyBorder());
            button.setPadding(new Insets(0, 0, 0, 0));
            button.setMargin(new Insets(0, 0, 0, 0));
            for (final UIState state : button.getStates()) {
                state.setBorder(null);
                state.setBackdrop(null);
            }
            button.setButtonText("");
            if (component.getOrientation() == Orientation.Horizontal) {
                button.setButtonIcon(new SubTex(_sharedTex, 147, 121, 16, 15));
                button.getMouseOverState().setIcon(new SubTex(_sharedTex, 147, 137, 16, 15));
            } else {
                button.setButtonIcon(new SubTex(_sharedTex, 97, 137, 15, 16));
                button.getMouseOverState().setIcon(new SubTex(_sharedTex, 113, 137, 15, 16));
            }
        }
        {
            final UISlider slider = component.getSlider();
            slider.getBackPanel().setBorder(new EmptyBorder());
View Full Code Here

        tfName.setText("player1");
        tfName.setLayoutData(GridLayoutData.WrapAndGrow);
        final UILabel lPassword = new UILabel("Password");
        final UIPasswordField tfPassword = new UIPasswordField();
        tfPassword.setLayoutData(GridLayoutData.WrapAndGrow);
        final UIButton btLogin = new UIButton("login");
        btLogin.addActionListener(new ActionListener() {
            public void actionPerformed(final ActionEvent event) {
                System.out.println("login as user: " + tfName.getText() + " password: " + tfPassword.getText());
            }
        });
        pLogin.add(lHeader);
View Full Code Here

        historyArea.setEditable(false);
        final UIScrollPanel scrollArea = new UIScrollPanel(historyArea);
        scrollArea.setLayoutData(BorderLayoutData.CENTER);
        final UITextField chatField = new UITextField();
        chatField.setLayoutData(BorderLayoutData.CENTER);
        final UIButton chatButton = new UIButton("SAY");
        chatButton.setLayoutData(BorderLayoutData.EAST);

        final ActionListener actionListener = new ActionListener() {
            public void actionPerformed(final ActionEvent event) {
                applyChat(historyArea, chatField);
            }
        };
        chatButton.addActionListener(actionListener);
        chatField.addActionListener(actionListener);

        bottomPanel.add(chatField);
        bottomPanel.add(chatButton);
View Full Code Here

        final UIPanel panel = new UIPanel();
        panel.setForegroundColor(ColorRGBA.DARK_GRAY);
        panel.setLayout(new BorderLayout());

        final UIButton button = new UIButton("Button A");
        final Texture tex = TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear,
                false);
        button.setIcon(new SubTex(tex));
        button.setIconDimensions(new Dimension(26, 26));
        button.setGap(10);
        button.setLayoutData(BorderLayoutData.NORTH);
        button.setTooltipText("This is a tooltip!");
        panel.add(button);

        final RowLayout rowLay = new RowLayout(false, false, false);
        final UIPanel centerPanel = new UIPanel(rowLay);
        centerPanel.setLayoutData(BorderLayoutData.CENTER);
View Full Code Here

TOP

Related Classes of com.ardor3d.extension.ui.UIButton

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.