Package nextapp.echo2.app

Examples of nextapp.echo2.app.PasswordField


       
        label = new Label(Messages.getString("LoginScreen.PromptPassword"));
        label.setStyleName("LoginScreen.Prompt");
        layoutGrid.add(label);
       
        passwordField = new PasswordField();
        passwordField.setWidth(PX_300);
        passwordField.setStyleName("Default");
        layoutGrid.add(passwordField);
        passwordField.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
View Full Code Here


       
        final TextField textField = new TextField();
        textField.setBorder(new Border(1, Color.BLUE, Border.STYLE_SOLID));
        testColumn.add(textField);
       
        final PasswordField passwordField = new PasswordField();
        passwordField.setBorder(new Border(1, Color.BLUE, Border.STYLE_SOLID));
        testColumn.add(passwordField);
       
        final TextArea textArea = new TextArea();
        textArea.setBorder(new Border(1, Color.BLUE, Border.STYLE_SOLID));
        testColumn.add(textArea);
       
        controlsColumn.addButton("Set Text to Multiple Lines", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String text = "This\nis\na\ntest.";
                textField.getDocument().setText(text);
                passwordField.getDocument().setText(text);
                textArea.getDocument().setText(text);
            }
        });
       
        controlsColumn.addButton("Test HTML Encoding", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String text = "<b>this should NOT be bold</b>";
                textField.getDocument().setText(text);
                passwordField.getDocument().setText(text);
                textArea.getDocument().setText(text);
            }
        });
       
        controlsColumn.addButton("Test Whitespace Encoding", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String text = "   There   are   three   spaces   leading,   trailing,   "
                        + "and   between   each   word.   ";
                textField.getDocument().setText(text);
                passwordField.getDocument().setText(text);
                textArea.getDocument().setText(text);
            }
        });
        controlsColumn.addButton("Toggle ToolTip Text", new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                if (textField.getToolTipText() == null) {
                    textField.setToolTipText("This is a tool tip.");
                    passwordField.setToolTipText("This is a tool tip.");
                    textArea.setToolTipText("This is a tool tip.");
                } else {
                    textField.setToolTipText(null);
                    passwordField.setToolTipText(null);
                    textArea.setToolTipText(null);
                }
            }
        });
        controlsColumn.addButton("Add ActionListener", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.addActionListener(actionListener);
                passwordField.addActionListener(actionListener);
                textArea.addActionListener(actionListener);
            }
        });
        controlsColumn.addButton("Remove ActionListener", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.removeActionListener(actionListener);
                passwordField.removeActionListener(actionListener);
                textArea.removeActionListener(actionListener);
            }
        });
        controlsColumn.addButton("Add DocumentListener", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.getDocument().addDocumentListener(documentListener);
                passwordField.getDocument().addDocumentListener(documentListener);
                textArea.getDocument().addDocumentListener(documentListener);
            }
        });
        controlsColumn.addButton("Remove DocumentListener", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.getDocument().removeDocumentListener(documentListener);
                passwordField.getDocument().removeDocumentListener(documentListener);
                textArea.getDocument().removeDocumentListener(documentListener);
            }
        });

        controlsColumn.addButton("Horizontal Scroll = 0px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setHorizontalScroll(new Extent(0));
                passwordField.setHorizontalScroll(new Extent(0));
                textArea.setHorizontalScroll(new Extent(0));
            }
        });
       
        controlsColumn.addButton("Horizontal Scroll = 100px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setHorizontalScroll(new Extent(100));
                passwordField.setHorizontalScroll(new Extent(100));
                textArea.setHorizontalScroll(new Extent(100));
            }
        });
       
        controlsColumn.addButton("Vertical Scroll = 0px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setVerticalScroll(new Extent(0));
                passwordField.setVerticalScroll(new Extent(0));
                textArea.setVerticalScroll(new Extent(0));
            }
        });
       
        controlsColumn.addButton("Vertical Scroll = 100px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setVerticalScroll(new Extent(100));
                passwordField.setVerticalScroll(new Extent(100));
                textArea.setVerticalScroll(new Extent(100));
            }
        });
       
        controlsColumn.addButton("Change Border (All Attributes)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Border border = StyleUtil.randomBorder();
                textField.setBorder(border);
                passwordField.setBorder(border);
                textArea.setBorder(border);
            }
        });
        controlsColumn.addButton("Change Border Color", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Border border = textField.getBorder();
                if (border == null) {
                    return;
                }
                border = new Border(border.getSize(), StyleUtil.randomColor(), border.getStyle());
                textField.setBorder(border);
                passwordField.setBorder(border);
                textArea.setBorder(border);
            }
        });
        controlsColumn.addButton("Change Border Size", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Border border = StyleUtil.nextBorderSize(textField.getBorder());
                if (border == null) {
                    return;
                }
                textField.setBorder(border);
                passwordField.setBorder(border);
                textArea.setBorder(border);
            }
        });
        controlsColumn.addButton("Change Border Style", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Border border = StyleUtil.nextBorderStyle(textField.getBorder());
                if (border == null) {
                    return;
                }
                textField.setBorder(border);
                passwordField.setBorder(border);
                textArea.setBorder(border);
            }
        });
        controlsColumn.addButton("Toggle Background Image", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                FillImage backgroundImage = textField.getBackgroundImage();
                if (backgroundImage == null) {
                    textField.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
                    passwordField.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
                    textArea.setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
                } else {
                    textField.setBackgroundImage(null);
                    passwordField.setBackgroundImage(null);
                    textArea.setBackgroundImage(null);
                }
            }
        });
        controlsColumn.addButton("Set Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Color color = StyleUtil.randomColor();
                textField.setForeground(color);
                passwordField.setForeground(color);
                textArea.setForeground(color);
            }
        });
        controlsColumn.addButton("Clear Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setForeground(null);
                passwordField.setForeground(null);
                textArea.setForeground(null);
            }
        });
        controlsColumn.addButton("Set Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Color color = StyleUtil.randomColor();
                textField.setBackground(color);
                passwordField.setBackground(color);
                textArea.setBackground(color);
            }
        });
        controlsColumn.addButton("Clear Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setBackground(null);
                passwordField.setBackground(null);
                textArea.setBackground(null);
            }
        });
        controlsColumn.addButton("Change Disabled Border (All Attributes)", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Border border = StyleUtil.randomBorder();
                textField.setDisabledBorder(border);
                passwordField.setDisabledBorder(border);
                textArea.setDisabledBorder(border);
            }
        });
        controlsColumn.addButton("Change Disabled Border Color", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Border border = textField.getDisabledBorder();
                if (border == null) {
                    return;
                }
                border = new Border(border.getSize(), StyleUtil.randomColor(), border.getStyle());
                textField.setDisabledBorder(border);
                passwordField.setDisabledBorder(border);
                textArea.setDisabledBorder(border);
            }
        });
        controlsColumn.addButton("Change Disabled Border Size", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Border border = StyleUtil.nextBorderSize(textField.getDisabledBorder());
                if (border == null) {
                    return;
                }
                textField.setDisabledBorder(border);
                passwordField.setDisabledBorder(border);
                textArea.setDisabledBorder(border);
            }
        });
        controlsColumn.addButton("Change Disabled Border Style", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Border border = StyleUtil.nextBorderStyle(textField.getDisabledBorder());
                if (border == null) {
                    return;
                }
                textField.setDisabledBorder(border);
                passwordField.setDisabledBorder(border);
                textArea.setDisabledBorder(border);
            }
        });
        controlsColumn.addButton("Toggle Disabled Background Image", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                FillImage backgroundImage = textField.getDisabledBackgroundImage();
                if (backgroundImage == null) {
                    textField.setDisabledBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
                    passwordField.setDisabledBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
                    textArea.setDisabledBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
                } else {
                    textField.setDisabledBackgroundImage(null);
                    passwordField.setDisabledBackgroundImage(null);
                    textArea.setDisabledBackgroundImage(null);
                }
            }
        });
        controlsColumn.addButton("Set Disabled Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Color color = StyleUtil.randomColor();
                textField.setDisabledForeground(color);
                passwordField.setDisabledForeground(color);
                textArea.setDisabledForeground(color);
            }
        });
        controlsColumn.addButton("Clear Disabled Foreground", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setDisabledForeground(null);
                passwordField.setDisabledForeground(null);
                textArea.setDisabledForeground(null);
            }
        });
        controlsColumn.addButton("Set Disabled Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Color color = StyleUtil.randomColor();
                textField.setDisabledBackground(color);
                passwordField.setDisabledBackground(color);
                textArea.setDisabledBackground(color);
            }
        });
        controlsColumn.addButton("Clear Disabled Background", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setDisabledBackground(null);
                passwordField.setDisabledBackground(null);
                textArea.setDisabledBackground(null);
            }
        });
        controlsColumn.addButton("Set MaximumLength=10", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setMaximumLength(10);
                passwordField.setMaximumLength(10);
                textArea.setMaximumLength(10);
            }
        });
        controlsColumn.addButton("Clear MaximumLength", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setMaximumLength(-1);
                passwordField.setMaximumLength(-1);
                textArea.setMaximumLength(-1);
            }
        });
        controlsColumn.addButton("Insets -> null", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setInsets(null);
                passwordField.setInsets(null);
                textArea.setInsets(null);
            }
        });
        controlsColumn.addButton("Insets -> 0px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setInsets(new Insets(0));
                passwordField.setInsets(new Insets(0));
                textArea.setInsets(new Insets(0));
            }
        });
        controlsColumn.addButton("Insets -> 5px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setInsets(new Insets(5));
                passwordField.setInsets(new Insets(5));
                textArea.setInsets(new Insets(5));
            }
        });
        controlsColumn.addButton("Insets -> 10/20/30/40px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setInsets(new Insets(10, 20, 30, 40));
                passwordField.setInsets(new Insets(10, 20, 30, 40));
                textArea.setInsets(new Insets(10, 20, 30, 40));
            }
        });
        controlsColumn.addButton("Width -> null", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setWidth(null);
                passwordField.setWidth(null);
                textArea.setWidth(null);
            }
        });
        controlsColumn.addButton("Width -> 500px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setWidth(new Extent(500, Extent.PX));
                passwordField.setWidth(new Extent(500, Extent.PX));
                textArea.setWidth(new Extent(500, Extent.PX));
            }
        });
        controlsColumn.addButton("Width -> 100%", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setWidth(new Extent(100, Extent.PERCENT));
                passwordField.setWidth(new Extent(100, Extent.PERCENT));
                textArea.setWidth(new Extent(100, Extent.PERCENT));
            }
        });
        controlsColumn.addButton("Height -> null", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setHeight(null);
                passwordField.setHeight(null);
                textArea.setHeight(null);
            }
        });
        controlsColumn.addButton("Height -> 300px", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                textField.setHeight(new Extent(300, Extent.PX));
                passwordField.setHeight(new Extent(300, Extent.PX));
                textArea.setHeight(new Extent(300, Extent.PX));
            }
        });
        controlsColumn.addButton("Toggle Enabled", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                boolean enabled = !textField.isEnabled();
                textField.setEnabled(enabled);
                passwordField.setEnabled(enabled);
                textArea.setEnabled(enabled);
            }
        });
        controlsColumn.addButton("Focus TextField", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
View Full Code Here

        this.getBtnMain().setBackground(Color.WHITE);
        this.getBtnMain().setBorder(BorderEx.NONE);
        this.getBtnMain().setRolloverBackground(Color.WHITE);
        this.getBtnMain().setRolloverBorder(BorderEx.NONE);

        this.setToggleIcon(new ResourceImageReference(IMG_DROPDOWN));
        this.setTogglePressedIcon(new ResourceImageReference(IMG_DROPDOWN));
        this.setToggleRolloverIcon(new ResourceImageReference(IMG_DROPDOWN));
       

        /*
        this.getBtnMain().addActionListener(new ActionListener() {

View Full Code Here

     * @param title The title of the button
     */
    public JbsAccPaneButton(String imgFileName, String title) {
        super();
        try {
            ResourceImageReference ref = new ResourceImageReference(Styles.getIconPath() + imgFileName);
            this.setIcon(ref);
        } catch (Exception e) {
            logger.debug(Styles.getIconPath() + imgFileName + " not found.");
        }
        this.setStyleName("Default");
View Full Code Here

        this.setBorder(BorderEx.NONE);
        this.setRolloverBorder(BorderEx.NONE);
        this.setTarget(this.getBtnMain());
        this.setPopUp(this.getMnuMain());
        this.setToggleIcon(new ResourceImageReference(IMG_DROPDOWN));
        this.setTogglePressedIcon(new ResourceImageReference(IMG_DROPDOWN));
        this.setToggleRolloverIcon(new ResourceImageReference(IMG_DROPDOWN));
    }
View Full Code Here

    private Logger logger = Logger.getLogger(BtnToolbar.class);
    private static final long serialVersionUID = 176100334500789000L;

    public BtnToolbar(String imgFileName) {
        super();
        ResourceImageReference ref = new ResourceImageReference(Styles.getIconPath() + imgFileName);
        if (ref != null) {
            this.setIcon(ref);
        } else {
            logger.warn("Image " + imgFileName + " not found.");
        }
View Full Code Here

                    break; // no icon
            }

            if (iconName != null) {
                final String imagePath = Styles.getIconPath(); //"../resource/images/";
                messageIcons[messageType] = new ResourceImageReference(
                        imagePath + iconName, new JbsExtent(ICON_HEIGHT), new JbsExtent(ICON_HEIGHT));
            }
        }

        return messageIcons[messageType];
View Full Code Here

    public void addControl(String groupName, Component control) {
        this.addControl(groupName, groupName, control);
    }

    public void addSeparator(String groupName) {
        Row row = new Row();
        ColumnLayoutData layout = new ColumnLayoutData();
        layout.setHeight(new JbsExtent(15, JbsExtent.PX));
        row.setLayoutData(layout);
        this.addControl(groupName, row);
    }
View Full Code Here

        spMain.add(pnMain);
    }

    protected JbsContentPane initPnButtons() {
        pnButtons = new JbsContentPane();
        Row mainRow = new Row();
        mainRow.setAlignment(new Alignment(Alignment.RIGHT, Alignment.DEFAULT));
        mainRow.setInsets(new Insets(new JbsExtent(5), new JbsExtent(5)));

        btnOK = new JbsButton(JbsL10N.getString("Generic.ok"));
        btnOK.setAlignmentHorizontal(Alignment.CENTER);
        btnOK.setWidth(new JbsExtent(80));
        btnOK.addActionListener(new ActionListener() {

            private static final long serialVersionUID = 1L;

            public void actionPerformed(ActionEvent arg0) {
                postDialog();
            }
        });
        mainRow.add(btnOK);

        btnCancel = new JbsButton(JbsL10N.getString("Generic.cancel"));
        btnCancel.setAlignmentHorizontal(Alignment.CENTER);
        btnCancel.setWidth(new JbsExtent(80));
        btnCancel.addActionListener(new ActionListener() {

            private static final long serialVersionUID = 1L;

            public void actionPerformed(ActionEvent arg0) {
                cancelDialog();
            }
        });
        mainRow.add(btnCancel);

        /*
        KeyStrokeListener ks = new KeyStrokeListener();
        ks.addKeyCombination(KeyStrokeListener.VK_RETURN,"OK");
        ks.addKeyCombination(KeyStrokeListener.VK_ESCAPE,"CANCEL");
        ks.addActionListener(new ActionListener() {
        private static final long serialVersionUID = 1L;
        public void actionPerformed(ActionEvent arg0) {
        if (arg0.getActionCommand().equals("OK"))
        postDialog();
        else if (arg0.getActionCommand().equals("CANCEL"))
        cancelDialog();
        }
        });
        mainRow.add(ks);
        mainRow.add(this.createKeyStrokeListener());
         */
        mainRow.add(this.getKeystrokeListener());
        pnButtons.add(mainRow);
        return pnButtons;
    }
View Full Code Here

        JbsLabel label = new JbsLabel(str);
        colMain.add(label);
    }
   
    public void addBlankLine() {
        Row row = new Row();
        ColumnLayoutData layout = new ColumnLayoutData();
        layout.setHeight(new JbsExtent(15,JbsExtent.PX));
        row.setLayoutData(layout);
        colMain.add(row);
    }
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.PasswordField

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.