Example usage for javax.swing JPasswordField JPasswordField

List of usage examples for javax.swing JPasswordField JPasswordField

Introduction

In this page you can find the example usage for javax.swing JPasswordField JPasswordField.

Prototype

public JPasswordField() 

Source Link

Document

Constructs a new JPasswordField, with a default document, null starting text string, and 0 column width.

Usage

From source file:org.codinjutsu.tools.jenkins.view.BuildParamDialog.java

private JPasswordField createPasswordField(String defaultValue) {
    JPasswordField passwordField = new JPasswordField();
    if (StringUtils.isNotEmpty(defaultValue)) {
        passwordField.setText(defaultValue);
    }/*from   w  ww .j a  v  a  2 s  . c  o  m*/
    return passwordField;
}

From source file:org.coronastreet.gpxconverter.AccountManager.java

public AccountManager(MainWindow window) {
    setTitle("Account Settings");
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    setBounds(100, 100, 450, 199);/*w w  w . j  a v a 2  s . c o m*/
    frmAccounts = new JPanel();
    frmAccounts.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(frmAccounts);
    frmAccounts.setLayout(null);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(5, 5, 424, 118);
    frmAccounts.add(tabbedPane);

    JPanel stravaPanel = new JPanel();
    stravaPanel.setLayout(null);

    tabbedPane.addTab("Strava", stravaPanel);

    strava_username = new JTextField();
    strava_username.setBounds(79, 11, 235, 20);
    stravaPanel.add(strava_username);
    strava_username.setColumns(10);

    JLabel lblUsername = new JLabel("Username:");
    lblUsername.setBounds(10, 14, 69, 14);
    stravaPanel.add(lblUsername);

    JLabel lblPassword = new JLabel("Password:");
    lblPassword.setBounds(10, 45, 69, 14);
    stravaPanel.add(lblPassword);

    strava_password = new JPasswordField();
    strava_password.setColumns(10);
    strava_password.setBounds(79, 42, 235, 20);
    stravaPanel.add(strava_password);

    JPanel rwgpsPanel = new JPanel();
    rwgpsPanel.setLayout(null);
    tabbedPane.addTab("RideWithGPS", rwgpsPanel);

    JLabel label = new JLabel("Username:");
    label.setBounds(10, 14, 69, 14);
    rwgpsPanel.add(label);

    rwgps_username = new JTextField();
    rwgps_username.setColumns(10);
    rwgps_username.setBounds(79, 11, 235, 20);
    rwgpsPanel.add(rwgps_username);

    rwgps_password = new JPasswordField();
    rwgps_password.setColumns(10);
    rwgps_password.setBounds(79, 42, 235, 20);
    rwgpsPanel.add(rwgps_password);

    JLabel label_1 = new JLabel("Password:");
    label_1.setBounds(10, 45, 69, 14);
    rwgpsPanel.add(label_1);

    JPanel garminPanel = new JPanel();
    garminPanel.setLayout(null);
    tabbedPane.addTab("Garmin Connect", garminPanel);

    JLabel label_2 = new JLabel("Username:");
    label_2.setBounds(10, 14, 69, 14);
    garminPanel.add(label_2);

    garmin_username = new JTextField();
    garmin_username.setColumns(10);
    garmin_username.setBounds(79, 11, 235, 20);
    garminPanel.add(garmin_username);

    garmin_password = new JPasswordField();
    garmin_password.setColumns(10);
    garmin_password.setBounds(79, 42, 235, 20);
    garminPanel.add(garmin_password);

    JLabel label_3 = new JLabel("Password:");
    label_3.setBounds(10, 45, 69, 14);
    garminPanel.add(label_3);

    loadAccountPrefs();

    JButton btnSave = new JButton("SAVE");
    btnSave.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            saveAccountInfo();
        }
    });
    btnSave.setBounds(106, 127, 89, 23);
    frmAccounts.add(btnSave);

    JButton btnCancel = new JButton("CANCEL");
    btnCancel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            cancel();
        }
    });
    btnCancel.setBounds(242, 127, 89, 23);
    frmAccounts.add(btnCancel);

}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.s3.gui.LoginLocalFolderPanel.java

private void initGui() {
    // Textual information.
    String descriptionText = "<html><center>"
            + "Your AWS Credentials are stored in encrypted files in a folder on "
            + "your computer. Each stored login has a nickname."
            + "<br><font size=\"-2\">You need to store your AWS credentials before you can use this login method.</font>"
            + "</center></html>";
    String folderTooltipText = "The folder containing your AWS Credentials";
    String browseButtonText = "Change Folder";
    String accountNicknameText = "Stored logins";
    String accountNicknameTooltipText = "Nicknames of the login credentials you have stored";
    String passwordLabelText = "Password";
    String passwordTooltipText = "The password that protects your encrypted file. "
            + "This password may be left empty if you are sure your computer cannot be compromised";

    // Components.
    JHtmlLabel descriptionLabel = new JHtmlLabel(descriptionText, hyperlinkListener);
    descriptionLabel.setHorizontalAlignment(JLabel.CENTER);
    folderPathTextField = new JTextField(this.cockpitHomeFolder.getAbsolutePath());
    folderPathTextField.setEnabled(false);
    folderPathTextField.setToolTipText(folderTooltipText);
    JButton browseButton = new JButton(browseButtonText);
    browseButton.addActionListener(this);
    JHtmlLabel accountNicknamesLabel = new JHtmlLabel(accountNicknameText, hyperlinkListener);
    nicknamesTableModel = new AWSCredentialsFileTableModel();
    accountNicknameTable = new JTable(nicknamesTableModel);
    accountNicknameTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    accountNicknameTable.setShowHorizontalLines(true);
    accountNicknameTable.getTableHeader().setVisible(false);
    JScrollPane accountNicknamesScrollPane = new JScrollPane(accountNicknameTable);
    accountNicknamesScrollPane.setToolTipText(accountNicknameTooltipText);
    JHtmlLabel passwordLabel = new JHtmlLabel(passwordLabelText, hyperlinkListener);
    passwordPasswordField = new JPasswordField();
    passwordPasswordField.setToolTipText(passwordTooltipText);

    int row = 0;// ww  w.jav a  2s .c  o m
    add(descriptionLabel, new GridBagConstraints(0, row++, 2, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    add(folderPathTextField, new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    add(browseButton, new GridBagConstraints(1, row++, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    add(accountNicknamesLabel, new GridBagConstraints(0, row++, 2, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    add(accountNicknamesScrollPane, new GridBagConstraints(0, row++, 2, 1, 0, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    add(passwordLabel, new GridBagConstraints(0, row++, 2, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    add(passwordPasswordField, new GridBagConstraints(0, row++, 2, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
}

From source file:org.jets3t.apps.cockpit.gui.LoginLocalFolderPanel.java

private void initGui() {
    // Textual information.
    String descriptionText = "<html><center>" + "Your credentials are stored in encrypted files in a folder on "
            + "your computer. Each stored login has a nickname."
            + "<br><font size=\"-2\">You need to store your credentials before you can use this login method.</font>"
            + "</center></html>";
    String folderTooltipText = "The folder containing your credentials";
    String browseButtonText = "Change Folder";
    String accountNicknameText = "Stored logins";
    String accountNicknameTooltipText = "Nicknames of the login credentials you have stored";
    String passwordLabelText = "Password";
    String passwordTooltipText = "The password that protects your encrypted file. "
            + "This password may be left empty if you are sure your computer cannot be compromised";

    // Components.
    JHtmlLabel descriptionLabel = new JHtmlLabel(descriptionText, hyperlinkListener);
    descriptionLabel.setHorizontalAlignment(JLabel.CENTER);
    folderPathTextField = new JTextField(this.cockpitHomeFolder.getAbsolutePath());
    folderPathTextField.setEnabled(false);
    folderPathTextField.setToolTipText(folderTooltipText);
    JButton browseButton = new JButton(browseButtonText);
    browseButton.addActionListener(this);
    JHtmlLabel accountNicknamesLabel = new JHtmlLabel(accountNicknameText, hyperlinkListener);
    nicknamesTableModel = new ProviderCredentialsFileTableModel();
    accountNicknameTable = new JTable(nicknamesTableModel);
    accountNicknameTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    accountNicknameTable.setShowHorizontalLines(true);
    accountNicknameTable.getTableHeader().setVisible(false);
    JScrollPane accountNicknamesScrollPane = new JScrollPane(accountNicknameTable);
    accountNicknamesScrollPane.setToolTipText(accountNicknameTooltipText);
    JHtmlLabel passwordLabel = new JHtmlLabel(passwordLabelText, hyperlinkListener);
    passwordPasswordField = new JPasswordField();
    passwordPasswordField.setToolTipText(passwordTooltipText);

    int row = 0;/*w w  w .  ja v  a2s .  co  m*/
    add(descriptionLabel, new GridBagConstraints(0, row++, 2, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    add(folderPathTextField, new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    add(browseButton, new GridBagConstraints(1, row++, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    add(accountNicknamesLabel, new GridBagConstraints(0, row++, 2, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    add(accountNicknamesScrollPane, new GridBagConstraints(0, row++, 2, 1, 0, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    add(passwordLabel, new GridBagConstraints(0, row++, 2, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    add(passwordPasswordField, new GridBagConstraints(0, row++, 2, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
}

From source file:org.jets3t.gui.skins.SkinsFactory.java

/**
 * @param itemName/*from ww  w.  ja  v  a 2  s .com*/
 * the name of this specific item in the GUI, which may be used to determine how the skinned
 * item should look or behave.
 *
 * @return
 * a <code>SkinnedJPasswordField</code> class implementation for the current skin, or a default
 * JPasswordField if no skin-specific implementation is available.
 */
public JPasswordField createSkinnedJPasswordField(String itemName) {
    Object instance = instantiateClass(buildSkinnedClassName("SkinnedJPasswordField"), itemName);
    if (instance != null) {
        return (JPasswordField) instance;
    } else {
        return new JPasswordField();
    }
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.UserProfile.java

/** Initializes the components composing this display. */
private void initComponents() {
    admin = false;/*from www  .j  a va 2s.c o m*/
    active = false;
    groupOwner = false;

    userPicture = new UserProfileCanvas();
    userPicture.setBackground(UIUtilities.BACKGROUND_COLOR);

    IconManager icons = IconManager.getInstance();
    changePhoto = new JLabel("Change Photo");
    changePhoto.setToolTipText("Upload your photo.");
    changePhoto.setForeground(UIUtilities.HYPERLINK_COLOR);
    Font font = changePhoto.getFont();
    changePhoto.setFont(font.deriveFont(font.getStyle(), font.getSize() - 2));
    changePhoto.setBackground(UIUtilities.BACKGROUND_COLOR);
    deletePhoto = new JButton(icons.getIcon(IconManager.DELETE_12));
    boolean b = canModifyPhoto();
    changePhoto.setVisible(b);
    deletePhoto.setToolTipText("Delete the photo.");
    deletePhoto.setBackground(UIUtilities.BACKGROUND_COLOR);
    UIUtilities.unifiedButtonLookAndFeel(deletePhoto);
    deletePhoto.setVisible(false);
    loginArea = new JTextField();
    boolean a = MetadataViewerAgent.isAdministrator();
    loginArea.setEnabled(a);
    loginArea.setEditable(a);
    adminBox = new JCheckBox();
    adminBox.setVisible(false);
    adminBox.setBackground(UIUtilities.BACKGROUND_COLOR);
    ownerBox = new JCheckBox();
    ownerBox.setBackground(UIUtilities.BACKGROUND_COLOR);
    activeBox = new JCheckBox();
    activeBox.setBackground(UIUtilities.BACKGROUND_COLOR);
    activeBox.setVisible(false);
    passwordButton = new JButton("Change password");
    passwordButton.setEnabled(false);
    passwordButton.setBackground(UIUtilities.BACKGROUND_COLOR);
    passwordButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            changePassword();
        }
    });
    saveButton = new JButton("Save");
    saveButton.setEnabled(false);
    saveButton.setBackground(UIUtilities.BACKGROUND_COLOR);
    saveButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            GroupData g = getSelectedGroup();
            ExperimenterData exp = (ExperimenterData) model.getRefObject();
            if (exp.getDefaultGroup().getId() != g.getId())
                model.fireAdminSaving(g, true);
            view.saveData(true);
        }
    });
    manageButton = new JButton("Group");
    manageButton.setEnabled(false);
    manageButton.setBackground(UIUtilities.BACKGROUND_COLOR);
    manageButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            manageGroup();
        }
    });
    passwordNew = new JPasswordField();
    passwordNew.setBackground(UIUtilities.BACKGROUND_COLOR);
    passwordConfirm = new JPasswordField();
    passwordConfirm.setBackground(UIUtilities.BACKGROUND_COLOR);
    oldPassword = new JPasswordField();
    oldPassword.setBackground(UIUtilities.BACKGROUND_COLOR);
    items = new HashMap<String, JTextField>();
    ExperimenterData user = (ExperimenterData) model.getRefObject();
    Collection<GroupData> groups = user.getGroups();

    GroupData defaultGroup = user.getDefaultGroup();

    groupsBox = new JComboBox();
    SelectableComboBoxModel m = new SelectableComboBoxModel();
    Iterator<GroupData> i = groups.iterator();
    GroupData g;
    Selectable<DataNode> node, selected = null;
    while (i.hasNext()) {
        g = i.next();
        if (!model.isSystemGroup(g.getId(), GroupData.USER)) {
            node = new Selectable<DataNode>(new DataNode(g), true);
            if (g.getId() == defaultGroup.getId())
                selected = node;
            m.addElement(node);
        }
    }
    groupsBox.setModel(m);
    if (selected != null)
        groupsBox.setSelectedItem(selected);
    permissionsPane = new PermissionsPane(defaultGroup.getPermissions(), UIUtilities.BACKGROUND_COLOR);
    permissionsPane.disablePermissions();

    ExperimenterData logUser = model.getCurrentUser();
    if (MetadataViewerAgent.isAdministrator()) {
        //Check that the user is not the one currently logged.
        oldPassword.setVisible(false);
        adminBox.setVisible(true);
        activeBox.setVisible(true);
        adminBox.addChangeListener(this);
        active = user.isActive();
        activeBox.setSelected(active);
        activeBox.setEnabled(!model.isSelf() && !model.isSystemUser(user.getId()));
        activeBox.addChangeListener(this);
        //indicate if the user is an administrator
        admin = isUserAdministrator();
        adminBox.setSelected(admin);
        adminBox.setEnabled(!model.isSelf() && !model.isSystemUser(user.getId()));
        ownerBox.addChangeListener(this);
        ownerBox.setEnabled(!model.isSystemUser(user.getId()));
    } else {
        ownerBox.setEnabled(false);
        passwordConfirm.getDocument().addDocumentListener(new DocumentListener() {

            /**
             * Allows the user to interact with the password controls
             * depending on the value entered.
             * @see DocumentListener#removeUpdate(DocumentEvent)
             */
            public void removeUpdate(DocumentEvent e) {
                handlePasswordEntered();
            }

            /**
             * Allows the user to interact with the password controls
             * depending on the value entered.
             * @see DocumentListener#insertUpdate(DocumentEvent)
             */
            public void insertUpdate(DocumentEvent e) {
                handlePasswordEntered();
            }

            /**
             * Required by the {@link DocumentListener} I/F but 
             * no-operation implementation in our case.
             * @see DocumentListener#changedUpdate(DocumentEvent)
             */
            public void changedUpdate(DocumentEvent e) {
            }
        });
    }
    passwordNew.getDocument().addDocumentListener(new DocumentListener() {

        /**
         * Allows the user to interact with the password controls
         * depending on the value entered.
         * @see DocumentListener#removeUpdate(DocumentEvent)
         */
        public void removeUpdate(DocumentEvent e) {
            handlePasswordEntered();
        }

        /**
         * Allows the user to interact with the password controls
         * depending on the value entered.
         * @see DocumentListener#insertUpdate(DocumentEvent)
         */
        public void insertUpdate(DocumentEvent e) {
            handlePasswordEntered();
        }

        /**
         * Required by the {@link DocumentListener} I/F but
         * no-operation implementation in our case.
         * @see DocumentListener#changedUpdate(DocumentEvent)
         */
        public void changedUpdate(DocumentEvent e) {
        }
    });
    if (user.getId() == logUser.getId()) {
        MouseAdapter adapter = new MouseAdapter() {

            /** Brings up a chooser to load the user image. */
            public void mouseReleased(MouseEvent e) {
                uploadPicture();
            }

        };
        changePhoto.addMouseListener(adapter);
        deletePhoto.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                model.deletePicture();
                setUserPhoto(null);
            }
        });
        if (groups.size() > 1) {
            groupsBox.addActionListener(new ActionListener() {

                /**
                 * Listens to the change of default group.
                 */
                public void actionPerformed(ActionEvent evt) {
                    GroupData g = getSelectedGroup();
                    //update the default group
                    permissionsPane.resetPermissions(g.getPermissions());
                    permissionsPane.disablePermissions();
                    setGroupOwner(g);
                    ExperimenterData exp = (ExperimenterData) model.getRefObject();
                    saveButton.setEnabled(exp.getDefaultGroup().getId() != g.getId());
                }
            });
        }
    }
}

From source file:org.ops4j.pax.idea.runner.forms.OsgiConfigEditorForm.java

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection HardCodedStringLiteral/* w  ww  .  j  ava 2  s. c  om*/
 */
private void $$$setupUI$$$() {
    m_mainPanel = new JPanel();
    m_mainPanel.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayoutManager(7, 1, new Insets(0, 0, 0, 0), -1, -1));
    m_mainPanel.add(panel1,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    final JPanel panel2 = new JPanel();
    panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
    panel1.add(panel2,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    panel2.setBorder(BorderFactory.createTitledBorder("Platform"));
    final JScrollPane scrollPane1 = new JScrollPane();
    panel2.add(scrollPane1,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null,
                    null, 0, false));
    m_platforms = new JList();
    scrollPane1.setViewportView(m_platforms);
    final JPanel panel3 = new JPanel();
    panel3.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1));
    panel1.add(panel3,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    panel3.setBorder(BorderFactory.createTitledBorder("Options"));
    m_startGui = new JCheckBox();
    m_startGui.setText("Start GUI");
    panel3.add(m_startGui,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    m_runClean = new JCheckBox();
    m_runClean.setText("Run Clean");
    panel3.add(m_runClean,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JScrollPane scrollPane2 = new JScrollPane();
    panel1.add(scrollPane2,
            new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null,
                    null, 0, false));
    scrollPane2.setBorder(BorderFactory.createTitledBorder("System Properties"));
    m_systemProperties = new JTable();
    m_systemProperties.setEnabled(true);
    scrollPane2.setViewportView(m_systemProperties);
    final JPanel panel4 = new JPanel();
    panel4.setLayout(new GridLayoutManager(4, 2, new Insets(0, 0, 0, 0), -1, -1));
    panel1.add(panel4,
            new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    panel4.setBorder(BorderFactory.createTitledBorder("Proxy"));
    final JLabel label1 = new JLabel();
    label1.setText("Port:");
    panel4.add(label1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JLabel label2 = new JLabel();
    label2.setText("Username:");
    panel4.add(label2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JLabel label3 = new JLabel();
    label3.setText("Password:");
    panel4.add(label3, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    m_proxyHost = new JTextField();
    panel4.add(m_proxyHost,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    m_proxyPort = new JTextField();
    panel4.add(m_proxyPort,
            new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    m_proxyUser = new JTextField();
    panel4.add(m_proxyUser,
            new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    m_proxyPass = new JPasswordField();
    panel4.add(m_proxyPass,
            new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    final JLabel label4 = new JLabel();
    label4.setHorizontalAlignment(10);
    label4.setHorizontalTextPosition(10);
    label4.setText("Host:");
    panel4.add(label4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JPanel panel5 = new JPanel();
    panel5.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
    panel1.add(panel5,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    final JLabel label5 = new JLabel();
    label5.setText("Working Dir:");
    panel5.add(label5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    m_workDir = new JTextField();
    panel5.add(m_workDir,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    m_selectDir = new JButton();
    m_selectDir.setText("...");
    panel5.add(m_selectDir,
            new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JPanel panel6 = new JPanel();
    panel6.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
    panel1.add(panel6,
            new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    final JLabel label6 = new JLabel();
    label6.setText("VM Arguments:");
    panel6.add(label6, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    m_vmArguments = new JTextField();
    panel6.add(m_vmArguments,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    final JPanel panel7 = new JPanel();
    panel7.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
    panel1.add(panel7,
            new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    final JLabel label7 = new JLabel();
    label7.setText("JDK:");
    panel7.add(label7, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    m_jdk = new JTextField();
    m_jdk.setEditable(false);
    panel7.add(m_jdk,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    final JPanel panel8 = new JPanel();
    panel8.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1));
    m_mainPanel.add(panel8,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    panel8.setBorder(BorderFactory.createTitledBorder("Bundles"));
    final JPanel panel9 = new JPanel();
    panel9.setLayout(new GridLayoutManager(1, 5, new Insets(0, 0, 0, 0), -1, -1));
    panel8.add(panel9,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    JButton add = new JButton();
    add.setText("Add...");
    panel9.add(add,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JScrollPane scrollPane3 = new JScrollPane();
    panel8.add(scrollPane3,
            new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null,
                    null, 0, false));
    scrollPane3.setBorder(BorderFactory.createTitledBorder("Properties"));
    m_bundleProperties = new JTable();
    scrollPane3.setViewportView(m_bundleProperties);
    final JScrollPane scrollPane4 = new JScrollPane();
    panel8.add(scrollPane4,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null,
                    null, 0, false));
    m_bundles = new JList();
    scrollPane4.setViewportView(m_bundles);
    final JPanel panel10 = new JPanel();
    panel10.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
    panel8.add(panel10,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    panel10.setBorder(BorderFactory.createTitledBorder("Description"));
    m_description = new JTextArea();
    panel10.add(m_description,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null,
                    new Dimension(150, 50), null, 0, false));
}

From source file:org.paxml.el.UtilFunctions.java

public static String ask(String question, boolean mask) {
    class DummyFrame extends JFrame {
        DummyFrame(String title) {
            super(title);
            setUndecorated(true);/* w  w w .j  a v  a  2s.  c o  m*/
            setVisible(true);
            setLocationRelativeTo(null);
        }
    }
    JPasswordField pf = new JPasswordField();
    DummyFrame frame = new DummyFrame(question);
    int okCxl = JOptionPane.showConfirmDialog(frame, pf, question, JOptionPane.OK_CANCEL_OPTION,
            JOptionPane.QUESTION_MESSAGE);
    frame.setVisible(false);
    if (okCxl == JOptionPane.OK_OPTION) {
        return new String(pf.getPassword());
    }
    return null;
}

From source file:org.paxml.security.SecretRepository.java

public static String askForPasswordInput(String question) {

    class DummyFrame extends JFrame {
        DummyFrame(String title) {
            super(title);
            setUndecorated(true);//from   ww w.j  av  a2  s. com
            setVisible(true);
            setLocationRelativeTo(null);
        }
    }
    JPasswordField pf = new JPasswordField();
    int okCxl = JOptionPane.showConfirmDialog(new DummyFrame(question), pf, question,
            JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);

    if (okCxl == JOptionPane.OK_OPTION) {
        return new String(pf.getPassword());
    }
    return null;
}

From source file:org.pentaho.reporting.engine.classic.core.modules.gui.pdf.PdfExportDialog.java

private void initializeComponents() {
    setTitle(getResources().getString("pdfsavedialog.dialogtitle")); //$NON-NLS-1$

    txAuthor = new JTextField();
    txAuthor.setColumns(40);//www  .  java  2s  .  co m
    txTitle = new JTextField();
    txTitle.setColumns(40);
    txKeywords = new JTextField();
    txKeywords.setColumns(40);
    txDescription = new JTextField();
    txDescription.setColumns(40);

    rbSecurityNone = new JRadioButton(getResources().getString("pdfsavedialog.securityNone")); //$NON-NLS-1$
    rbSecurity40Bit = new JRadioButton(getResources().getString("pdfsavedialog.security40bit")); //$NON-NLS-1$
    rbSecurity128Bit = new JRadioButton(getResources().getString("pdfsavedialog.security128bit")); //$NON-NLS-1$

    final Action securitySelectAction = new ActionSecuritySelection();
    rbSecurityNone.addActionListener(securitySelectAction);
    rbSecurity40Bit.addActionListener(securitySelectAction);
    rbSecurity128Bit.addActionListener(securitySelectAction);

    rbSecurity128Bit.setSelected(true);

    txUserPassword = new JPasswordField();
    txConfUserPassword = new JPasswordField();
    txOwnerPassword = new JPasswordField();
    txConfOwnerPassword = new JPasswordField();

    cxAllowCopy = new JCheckBox(getResources().getString("pdfsavedialog.allowCopy")); //$NON-NLS-1$
    cbAllowPrinting = new JComboBox(getPrintingComboBoxModel());
    cxAllowScreenReaders = new JCheckBox(getResources().getString("pdfsavedialog.allowScreenreader")); //$NON-NLS-1$

    cxAllowAssembly = new JCheckBox(getResources().getString("pdfsavedialog.allowAssembly")); //$NON-NLS-1$
    cxAllowModifyContents = new JCheckBox(getResources().getString("pdfsavedialog.allowModifyContents")); //$NON-NLS-1$
    cxAllowModifyAnnotations = new JCheckBox(getResources().getString("pdfsavedialog.allowModifyAnnotations")); //$NON-NLS-1$
    cxAllowFillIn = new JCheckBox(getResources().getString("pdfsavedialog.allowFillIn")); //$NON-NLS-1$

    txFilename = new JTextField();
    txFilename.setColumns(40);
    statusBar = new JStatusBar();

    encodingModel = EncodingComboBoxModel.createDefaultModel(Locale.getDefault());
    encodingModel.sort();

    cbEncoding = new JComboBox(encodingModel);
    cxEmbedded = new JCheckBox(getResources().getString("pdfsavedialog.embedfonts"));

    getFormValidator().registerTextField(txFilename);
    getFormValidator().registerTextField(txConfOwnerPassword);
    getFormValidator().registerTextField(txConfUserPassword);
    getFormValidator().registerTextField(txUserPassword);
    getFormValidator().registerTextField(txOwnerPassword);

    final JPanel exportPane = createExportPanel();
    final Configuration config = ClassicEngineBoot.getInstance().getGlobalConfig();
    final boolean advancedSettingsTabAvail = "true".equals(config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.modules.gui.pdf.AdvancedSettingsAvailable"));
    final boolean metaDataSettingsTabAvail = "true".equals(config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.modules.gui.pdf.MetaDataSettingsAvailable"));
    final JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add(getResources().getString("pdfsavedialog.export-settings"), exportPane); //$NON-NLS-1$
    tabbedPane.add(getResources().getString("pdfsavedialog.parameters"), getParametersPanel());

    if (metaDataSettingsTabAvail) {
        tabbedPane.add(getResources().getString("pdfsavedialog.metadata-settings"), createMetaDataPanel()); //$NON-NLS-1$
    }
    if (advancedSettingsTabAvail) {
        tabbedPane.add(getResources().getString("pdfsavedialog.advanced-settings"), createAdvancedPanel()); //$NON-NLS-1$
    }
    setContentPane(createContentPane(tabbedPane));

}