Package javax.swing

Examples of javax.swing.JPasswordField


    proxyPortLabel = new JLabel(SettingsMessages.getInstance().getString("ProxySettingsPanel.proxyPort"));
    userLabel = new JLabel(SettingsMessages.getInstance().getString("ProxySettingsPanel.user"));
    passwordLabel = new JLabel(SettingsMessages.getInstance().getString("ProxySettingsPanel.password"));

    userTextField = new JTextField(null, 0);
    passwordField = new JPasswordField();
    passwordField.setPreferredSize(userTextField.getPreferredSize());

    final JPanel contentPanel = new JPanel();
    contentPanel.setLayout(new GridBagLayout());
    final GridBagConstraints c = new GridBagConstraints();
View Full Code Here


        items[1] = new LabelledComponent(acr.getString(acr.I_BROKER_PORT), portTF);

        userTF = new JTextField(BrokerAdmin.DEFAULT_ADMIN_USERNAME, 10);
        items[2] = new LabelledComponent(acr.getString(acr.I_BROKER_USERNAME), userTF);

        passwdTF = new JPasswordField("", 10);
        items[3] = new LabelledComponent(acr.getString(acr.I_BROKER_PASSWD), passwdTF);

        LabelValuePanel lvp = new LabelValuePanel(items, 4, 4);

  workConstraints.gridx = 0;
View Full Code Here

  principalText = new JTextField(20);
  principalText.addActionListener(this);
  items[0] = new LabelledComponent(Context.SECURITY_PRINCIPAL + ":",
                 principalText);
  credentialsText = new JPasswordField(20);
  credentialsText.addActionListener(this);
  items[1] = new LabelledComponent(Context.SECURITY_CREDENTIALS + ":",
                 credentialsText);
 
  LabelValuePanel lvp = new LabelValuePanel(items, 5, 5);
View Full Code Here

    urlModel = new DefaultComboBoxModel();
    urlCombo = new JComboBox(urlModel);

    userField = new JTextField(25);
    userPasswordField = new JPasswordField();

    final SpinnerNumberModel spinnerModel = new SpinnerNumberModel();
    spinnerModel.setMinimum(0);
    spinnerModel.setMaximum(99999);
View Full Code Here

    m_dbU.setSize(128, 24);
    m_dbU.setText("MySQL Username");
    m_dbU.setLocation(4, 192);
    m_gui.getContentPane().add(m_dbU);
   
    m_dbP = new JPasswordField();
    m_dbP.setSize(128, 24);
    m_dbP.setText("Pass");
    m_dbP.setLocation(4, 224);
    m_gui.getContentPane().add(m_dbP);
   
View Full Code Here

* {@link BindableModel}.
*/
public class JPasswordFieldWiringHarness implements WiringHarness<Bound, Field> {
    public Collection<Binding> wire(Bound bound, BindingContext context, Field field) throws IllegalAccessException, IntrospectionException {
        String target = bound.to();
        JPasswordField pwdField = context.getFieldObject(field, JPasswordField.class);
        ObjectFieldMethod setter = context.findSetter(target);
        ObjectFieldMethod getter = context.findGetter(target);
        if (setter == null || getter == null) {
            throw new IllegalArgumentException("could not find getter/setter for " + target);
        }
View Full Code Here

     * For now it only has option to change password<br />
     * @return JPanel with all the password fields for user to change their password
     */
    public final JPanel settingsPanel(){
        JPanel p = new JPanel();
        final JPasswordField oldpassword = new JPasswordField("",15);
        final JPasswordField password = new JPasswordField("",15);
        final JPasswordField repassword = new JPasswordField("",15);
        JButton registerButton = new JButton("Change");
        registerButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
                boolean noErrors = true;
                String error = "";
                final String oldpass = new String(oldpassword.getPassword());
                final String pass = new String(password.getPassword());
                final String repass = new String(repassword.getPassword());
                File file = new File("login");
                if(file.exists()){
                        Json localJson= null;
                        String md5pass = "";
                        try {
                            md5pass = md5(oldpass);
                        } catch (NoSuchAlgorithmException ex) {
                            Logger.getLogger(cLoginWindow.class.getName()).log(Level.SEVERE, "Couldn't get md5 hash of the password", ex);
                        }
                        try {
                            String strLine = "";
                            DataInputStream in = new DataInputStream(new FileInputStream(file));
                            BufferedReader br = new BufferedReader(new InputStreamReader(in));
                            try {
                                while ((strLine = br.readLine())!= null)   {
                                    break;
                                }
                                in.close();
                                localJson = Json.read(strLine);
                            } catch (IOException ex) {
                                Logger.getLogger(cLoginWindow.class.getName()).log(Level.SEVERE,"Cannot read line in the file", ex);
                            }
                        } catch (FileNotFoundException ex) {
                            Logger.getLogger(cLoginWindow.class.getName()).log(Level.SEVERE,"File not found", ex);
                        }
                        final String id = localJson.at("id").asString();
                        if(!md5pass.equals(localJson.at("password").asString())){
                            noErrors = false;
                            error += "Old password dont match \n";
                        }
                       
                       if(!(pass.equals(repass)) || pass.length() == 0){
                            noErrors = false;
                            error += "Both the password must match with each other \n";
                        }
                        if(noErrors){
                            Map<String,String> rdata = new HashMap<String, String>(){{put("id",id);put("oldpass",oldpass);put("newpass",pass);}};
                            bFetchURL url = new bFetchURL("http://binaydevkota.com/javabus/changepassword.php",rdata,"GET");
                        String returnedText = null;
                            try {
                                returnedText = url.content();
                            } catch (NullPointerException ex){
                                JOptionPane.showMessageDialog(null, "Sorry cannot connect to server, change password failed", "Error", JOptionPane.ERROR_MESSAGE);
                            }
                            catch (IOException ex) {
                                JOptionPane.showMessageDialog(null, "Sorry cannot connect to server, change password failed", "Error", JOptionPane.ERROR_MESSAGE);
                            }
                            Json returnedJson = Json.read(returnedText);
                            if(!returnedJson.at("error").isNull()){
                                JOptionPane.showMessageDialog(null, returnedJson.at("error").asString(), "Error", JOptionPane.ERROR_MESSAGE);
                            }
                            if(!returnedJson.at("info").isNull()){
                                JOptionPane.showMessageDialog(null, returnedJson.at("info").asString(), "Info", JOptionPane.INFORMATION_MESSAGE);
                            }

                            if(!returnedJson.at("success").isNull()){
                                File files = new File("login");
                                files.delete();
                                new cLoginWindow();
                                dispose();
                            }
                        }
                        else{
                            JOptionPane.showMessageDialog(null, error, "Error",JOptionPane.ERROR_MESSAGE);
                        }    
                }
                else{
                    JOptionPane.showMessageDialog(null, "You need to login to change password");
                }

            }
        });
       
        p.setLayout(new GridLayout(0,2));
       
        p.add(new JLabel("Old Password: "));
        oldpassword.setFont(new Font("Dialog", 1,20));
        p.add(oldpassword);
       
        p.add(new JLabel(""));
        p.add(new JLabel(""));
       
        p.add(new JLabel("New Password: "));
        password.setFont(new Font("Dialog", 1,20));
        p.add(password);
       
        p.add(new JLabel(""));
        p.add(new JLabel(""));
       
        p.add(new JLabel("Password again: "));
        repassword.setFont(new Font("Dialog", 1,20));
        p.add(repassword);
       
        p.add(new JLabel(""));
        p.add(new JLabel(""));
       
View Full Code Here

        return JOptionPane.showConfirmDialog(parent, panel, title, JOptionPane.OK_CANCEL_OPTION);
    }

    private JTextField createTextField(final List<FormItem> items, FormItem item) {
        String defaultValue = item.getDefaultValue();
        JTextField field = (item.isPassword() ? new JPasswordField() : new JTextField());
        if (defaultValue != null) {
            field.setText(defaultValue);
        }
        item.setField(field);
        field.getDocument().addDocumentListener(new DocumentListener() {
View Full Code Here

     */
    public dRegisterWindow(){ //main method for the this class
       
        //init the fields
        final JTextField username = new JTextField("",15);
        final JPasswordField password = new JPasswordField("",15);
        final JPasswordField repassword = new JPasswordField("",15);
        final JTextField email = new JTextField("",15);
        final JTextField pin = new JTextField("",4);

        JButton registerButton = new JButton("Register");
        registerButton.addActionListener(new ActionListener() { //register button action
            @Override
            public void actionPerformed(ActionEvent evt) {
                /* Validations*/
                boolean noErrors = true;
               
                // get value from fields
                final String name = username.getText();
                final String pass = new String(password.getPassword());
                String repass = new String(repassword.getPassword());
                final String p = pin.getText();
                final String em = email.getText();
                String error = "";
               
                //validate and check for errors
View Full Code Here

        return textField;
    }

    private JPasswordField createPasswordField(Container pane, String label) {
        JPasswordField textField = new JPasswordField(60);
        JLabel textLabel = new JLabel(label, JLabel.TRAILING);
        textLabel.setLabelFor(textField);

        pane.add(textLabel);
        pane.add(textField);
View Full Code Here

TOP

Related Classes of javax.swing.JPasswordField

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.