Package com.ardor3d.extension.ui.event

Examples of com.ardor3d.extension.ui.event.ActionListener


        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


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

        slider.setSnapToValues(true);
        slider.setMinimumContentWidth(100);

        final UILabel lSliderValue = new UILabel("0");
        lSliderValue.setLayoutData(GridLayoutData.SpanAndWrap(2));
        slider.addActionListener(new ActionListener() {
            public void actionPerformed(final ActionEvent event) {
                lSliderValue.setText(String.valueOf(slider.getValue()));
            }
        });
        centerPanel.add(slider);
View Full Code Here

                }
                return component;
            }
        };

        _openButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent event) {
                if (!isEnabled()) {
                    return;
                }

                if (_valuesMenu.isAttachedToHUD()) {
                    _valuesMenu.getHud().closePopupMenus();
                }

                _valuesMenu.clearItems();
                for (int i = 0; i < _model.size(); i++) {
                    final UIMenuItem item = new UIMenuItem("" + _model.getValueAt(i));
                    if (_itemSkinCallback != null) {
                        _itemSkinCallback.skinComponent(item);
                    }
                    if (i == getSelectedIndex()) {
                        item.addFontStyle(StyleConstants.KEY_BOLD, Boolean.TRUE);
                    }
                    final int index = i;
                    item.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(final ActionEvent event) {
                            setSelectedIndex(index);
                        }
                    });
View Full Code Here

        _titleLabel = new UILabel("- untitled -");
        attachChild(_titleLabel);

        if (buttons.contains(FrameButtons.HELP)) {
            _helpButton = createFrameButton("?");
            _helpButton.addActionListener(new ActionListener() {
                public void actionPerformed(final ActionEvent event) {
                // TODO: Implement
                }
            });
            attachChild(_helpButton);
        } else {
            _helpButton = null;
        }

        if (buttons.contains(FrameButtons.MINIMIZE)) {
            _minimizeButton = createFrameButton("_");
            _minimizeButton.addActionListener(new ActionListener() {
                public void actionPerformed(final ActionEvent event) {
                // TODO: Implement
                }
            });
            attachChild(_minimizeButton);
        } else {
            _minimizeButton = null;
        }

        if (buttons.contains(FrameButtons.MAXIMIZE)) {
            _maximizeButton = createFrameButton("^");
            _maximizeButton.addActionListener(new ActionListener() {
                public void actionPerformed(final ActionEvent event) {
                    // XXX: Should this also update the button img?
                    final UIFrame frame = (UIFrame) getParent();
                    if (frame.isMaximized()) {
                        frame.restore();
                    } else {
                        frame.maximize();
                    }
                }
            });
            attachChild(_maximizeButton);
        } else {
            _maximizeButton = null;
        }

        if (buttons.contains(FrameButtons.CLOSE)) {
            _closeButton = createFrameButton("x");
            _closeButton.addActionListener(new ActionListener() {
                public void actionPerformed(final ActionEvent event) {
                    ((UIFrame) getParent()).close();
                }
            });
            attachChild(_closeButton);
View Full Code Here

        verticalScrollBar = new UIScrollBar(Orientation.Vertical);
        verticalScrollBar.setLayoutData(BorderLayoutData.EAST);
        add(horizontalScrollBar);
        add(verticalScrollBar);
        setDoClip(true);
        horizontalScrollBar.addActionListener(new ActionListener() {
            public void actionPerformed(final ActionEvent event) {
                offsetX = horizontalScrollBar.getValue();
                fireComponentDirty();
                updateScrollBarSliders();
            }
        });
        verticalScrollBar.addActionListener(new ActionListener() {
            public void actionPerformed(final ActionEvent event) {
                offsetY = verticalScrollBar.getValue();
                fireComponentDirty();
                updateScrollBarSliders();
            }
View Full Code Here

        updateMinimumSizeFromContents();
        compact();

        layout();
        final ActionListener al = new ActionListener() {
            public void actionPerformed(final ActionEvent event) {
                int direction;
                if (event.getSource() == btTopLeft) {
                    direction = UIScrollBar.this.orientation == Orientation.Horizontal ? -1 : 1;
                } else {
                    direction = UIScrollBar.this.orientation == Orientation.Horizontal ? 1 : -1;
                }
                int offset = slider.getValue();
                if (direction < 0) {
                    offset -= 10;
                    if (offset < 0) {
                        offset = 0;
                    }
                } else {
                    offset += 10;
                    if (offset > slider.getModel().getMaxValue()) {
                        offset = slider.getModel().getMaxValue();
                    }
                }
                slider.setValue(offset);
                fireChangeEvent();
            }
        };
        btTopLeft.addActionListener(al);
        btBottomRight.addActionListener(al);
        slider.addActionListener(new ActionListener() {
            public void actionPerformed(final ActionEvent event) {
                fireChangeEvent();
            }
        });
    }
View Full Code Here

     *            optional label icon
     * @return the new UITab
     */
    private UITab makeTab(final String label, final SubTex icon) {
        final UITab button = new UITab(label, icon, _placement);
        button.addActionListener(new ActionListener() {
            public void actionPerformed(final ActionEvent event) {
                setCurrentTab(button);
            }
        });
        _tabButtonGroup.add(button);
View Full Code Here

    public UIMenuItem(final String text, final SubTex icon) {
        super(text, icon);

        // Close menus when a menu item is clicked
        addActionListener(new ActionListener() {
            public void actionPerformed(final ActionEvent event) {
                final UIHud hud = getHud();
                if (hud != null) {
                    hud.closePopupMenus();
                }
View Full Code Here

        final UIFrame frame = new UIFrame("Controls", EnumSet.noneOf(FrameButtons.class));
        frame.setResizeable(false);

        final UILabel turnLabel = new UILabel("Turn Speed: " + ROCKET_TURN_SPEED);
        final UISlider turnSlider = new UISlider(Orientation.Horizontal, 0, 250, (int) (ROCKET_TURN_SPEED * 10));
        turnSlider.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent event) {
                ROCKET_TURN_SPEED = turnSlider.getValue() / 10;
                turnLabel.setText("Turn Speed: " + ROCKET_TURN_SPEED);
            }
        });

        final UILabel propelLabel = new UILabel("Propel Speed: " + ROCKET_PROPEL_SPEED);
        final UISlider propelSlider = new UISlider(Orientation.Horizontal, 0, 250, (int) (ROCKET_PROPEL_SPEED));
        propelSlider.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent event) {
                ROCKET_PROPEL_SPEED = propelSlider.getValue();
                propelLabel.setText("Propel Speed: " + ROCKET_PROPEL_SPEED);
            }
        });

        final UILabel ageLabel = new UILabel("Max Age of Smoke: " + age + " ms");
        final UISlider ageSlider = new UISlider(Orientation.Horizontal, 25, 400, age / 10);
        ageSlider.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent event) {
                age = ageSlider.getValue() * 10;
                ageLabel.setText("Max Age of Smoke: " + age + " ms");
                smoke.setMaximumLifeTime(age);
                smoke.setMinimumLifeTime(age / 2);
            }
        });

        final UICheckBox twoDimCheck = new UICheckBox("Constrain Rocket to 2D Plane.");
        twoDimCheck.setSelected(stayIn2DPlane);
        twoDimCheck.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent event) {
                stayIn2DPlane = twoDimCheck.isSelected();
            }
        });

        final UICheckBox worldCoordsCheck = new UICheckBox("Particles are in world coords");
        worldCoordsCheck.setSelected(particleInWorld);
        worldCoordsCheck.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent event) {
                particleInWorld = worldCoordsCheck.isSelected();
                smoke.setParticlesInWorldCoords(particleInWorld);
            }
View Full Code Here

TOP

Related Classes of com.ardor3d.extension.ui.event.ActionListener

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.