微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javax.swing.JPasswordField的实例源码

项目:incubator-netbeans    文件CodeSetupPanel.java   
@Override
public TableCellEditor getCellEditor(int row,int column) {
    if(showParamTypes) {
        String paramName = (String) tableModel.getValueAt(row,0);
        Class type = (column == 2) ? (Class) tableModel.getValueAt(row,1) : Boolean.class;

        if (Enum.class.isAssignableFrom(type)) {
            JComboBox combo = new JComboBox(type.getEnumConstants());
            return new DefaultCellEditor(combo);
        } else if (type == Boolean.class || type == Boolean.TYPE) {
            JCheckBox cb = new JCheckBox();
            cb.setHorizontalAlignment(JLabel.CENTER);
            cb.setBorderPainted(true);
            return new DefaultCellEditor(cb);
        } else if (paramName.toLowerCase().contains(Constants.PASSWORD)) {
            return new DefaultCellEditor(new jpasswordfield());
        }
    }

    return super.getCellEditor(row,column);
}
项目:incubator-netbeans    文件CodeSetupPanel.java   
@Override
public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column) {
    Component ret = super.getTableCellRendererComponent(table,value,isSelected,hasFocus,row,column);
    String paramName = (String) tableModel.getValueAt(row,0);

    if (value == null) {
        return new JLabel(NbBundle.getMessage(CodeSetupPanel.class,"LBL_NotSet"));
    } else if (value instanceof Class) {
        return new JLabel(((Class) value).getName());
    } else if (value instanceof Boolean) {
        JCheckBox cb = new JCheckBox();
        cb.setHorizontalAlignment(JLabel.CENTER);
        cb.setBorderPainted(true);
        cb.setSelected((Boolean) value);
        return cb;
    } else if (paramName.contains(Constants.PASSWORD)) {
        return new jpasswordfield((String) value);
    } 
    return ret;
}
项目:dracoon-dropzone    文件Dropzone.java   
/**
 * Show master password dialog if enabled
 */
private void showMasterPasswordEntry() {
    ConfigIO cfg = ConfigIO.getInstance();
    if (cfg.isMasterPwdEnabled()) {
        JPanel panel = new JPanel(new BorderLayout());
        jpasswordfield pf = new jpasswordfield();
        panel.setBorder(new EmptyBorder(0,10,10));
        panel.add(pf,BorderLayout.norTH);
        JFrame frame = new JFrame();
        frame.setAlwaysOnTop(true);

        int option = JOptionPane.showConfirmDialog(frame,panel,I18n.get("main.start.requestmasterpwd"),JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE);
        frame.@R_502_6422@pose();
        if (option == JOptionPane.OK_OPTION) {
            cfg.setMasterPassword(new String(pf.getpassword()));
        } else {
            // Todo show config dialog
        }
    }
}
项目:dracoon-dropzone    文件Dropzone.java   
/**
 * Show password dialog if enabled
 */
private String showPasswordDialog() {
    JPanel panel = new JPanel(new BorderLayout());
    jpasswordfield pf = new jpasswordfield();
    panel.setBorder(new EmptyBorder(0,10));
    panel.add(pf,BorderLayout.norTH);
    JFrame frame = new JFrame();
    frame.setAlwaysOnTop(true);
    pf.requestFocus();

    int option = JOptionPane.showConfirmDialog(frame,I18n.get("main.start.sharelinkpwd"),JOptionPane.PLAIN_MESSAGE);
    frame.@R_502_6422@pose();
    if (option == JOptionPane.OK_OPTION) {
        return new String(pf.getpassword());
    } else {
        return null;
    }
}
项目:KernelHive    文件UserCredentialsPanel.java   
public UserCredentialsPanel(){
    setSize(new Dimension(900,300));
    setPreferredSize(new Dimension(900,300));
    setMinimumSize(new Dimension(450,300));
    setLayout(null);

    JLabel lblUsername = new JLabel("Username");
    lblUsername.setBounds(12,12,86,15);
    add(lblUsername);

    JLabel lblPassword = new JLabel("Password");
    lblPassword.setBounds(12,49,70,15);
    add(lblPassword);

    usernameField = new JTextField();
    usernameField.setBounds(116,114,19);
    add(usernameField);
    usernameField.setColumns(10);

    passwordField = new jpasswordfield();
    passwordField.setBounds(116,47,19);
    add(passwordField);
}
项目:Equella    文件AbstractTLFPlugin.java   
@Override
public void initGUI()
{
    userField = new JTextField();
    passField = new jpasswordfield();

    liveOnly = new JCheckBox();
    harvestLearningObjects = new JCheckBox();
    harvestResources = new JCheckBox();

    panel.addComponent(new JLabel(getString(getPluginsFieldString())));
    panel.addNameAndComponent(getString("detailstab.user"),userField);
    panel.addNameAndComponent(getString("detailstab.pass"),passField);

    panel.addNameAndComponent(getString("loraxplugin.live"),liveOnly);
    panel.addNameAndComponent(getString("loraxplugin.harvestlo"),harvestLearningObjects);
    panel.addNameAndComponent(getString("loraxplugin.harvestre"),harvestResources);

}
项目:zencash-swing-wallet-ui    文件PasswordEncryptionDialog.java   
public PasswordEncryptionDialog(JFrame parent)
{
    super(parent);

    this.upperLabel.setText(
        "<html>The wallet.dat file will be encrypted with a password. If the operation is successful," +
           "zend will automatically stop and will need to be restarted. The GUI wallet will also be stopped " +
           "and will need to be restarted. Please enter the password:</html>");

    JLabel confLabel = new JLabel("Confirmation: ");
    this.freeSlotPanel.add(confLabel);
    this.freeSlotPanel.add(passwordConfirmationField = new jpasswordfield(30));
    this.passwordLabel.setPreferredSize(confLabel.getPreferredSize());

    JLabel dividerLabel = new JLabel("   ");
    dividerLabel.setFont(new Font("Helvetica",Font.PLAIN,8));
    this.freeSlotPanel2.add(dividerLabel);

    this.setSize(460,270);
    this.validate();
    this.repaint();
}
项目:komodoGUI    文件PasswordEncryptionDialog.java   
public PasswordEncryptionDialog(JFrame parent)
{
    super(parent);

    this.upperLabel.setText(
        "<html>The wallet.dat file will be encrypted with a password. If the operation is successful," +
           "zcashd will automatically stop and will need to be restarted. The GUI wallet will also be stopped " +
           "and will need to be restarted. Please enter the password:</html>");

    JLabel confLabel = new JLabel("Confirmation: ");
    this.freeSlotPanel.add(confLabel);
    this.freeSlotPanel.add(passwordConfirmationField = new jpasswordfield(30));
    this.passwordLabel.setPreferredSize(confLabel.getPreferredSize());

    JLabel dividerLabel = new JLabel("   ");
    dividerLabel.setFont(new Font("Helvetica",270);
    this.validate();
    this.repaint();
}
项目:jiracli    文件CredentialsPanel.java   
private CredentialsPanel(String username,String url) {
    this.url = url;
    this.usernamePassword = new JRadioButton("Username and password");
    this.usernamePassword.addActionListener(new RadioButtonListener());
    this.anonymous = new JRadioButton("Anonymous access");
    this.anonymous.addActionListener(new RadioButtonListener());
    this.buttonGroup = new ButtonGroup();
    this.buttonGroup.add(usernamePassword);
    this.buttonGroup.add(anonymous);
    this.usernameLabel = new JLabel("Username:");
    this.username = new JTextField(Objects.toString(username,""),20);
    this.passwordLabel = new JLabel("Password:");
    this.password = new jpasswordfield(20);
    if (username == null || username.isEmpty()) {
        this.anonymous.setSelected(true);
    } else {
        this.usernamePassword.setSelected(true);
        this.password.addAncestorListener(new RequestFocusListener());
    }
    radioButtonToggled();
    layoutComponents();
}
项目:Openjsharp    文件PasswordView.java   
/**
 * Renders the given range in the model as normal unselected
 * text.  This sets the foreground color and echos the characters
 * using the value returned by getEchoChar().
 *
 * @param g the graphics context
 * @param x the starting X coordinate &gt;= 0
 * @param y the starting Y coordinate &gt;= 0
 * @param p0 the starting offset in the model &gt;= 0
 * @param p1 the ending offset in the model &gt;= p0
 * @return the X location of the end of the range &gt;= 0
 * @exception BadLocationException if p0 or p1 are out of range
 */
protected int drawUnselectedText(Graphics g,int x,int y,int p0,int p1) throws BadLocationException {

    Container c = getContainer();
    if (c instanceof jpasswordfield) {
        jpasswordfield f = (jpasswordfield) c;
        if (! f.echoCharIsSet()) {
            return super.drawUnselectedText(g,x,y,p0,p1);
        }
        if (f.isEnabled()) {
            g.setColor(f.getForeground());
        }
        else {
            g.setColor(f.get@R_502_6422@abledTextColor());
        }
        char echoChar = f.getEchoChar();
        int n = p1 - p0;
        for (int i = 0; i < n; i++) {
            x = drawEchoCharacter(g,echoChar);
        }
    }
    return x;
}
项目:Openjsharp    文件PasswordView.java   
/**
 * Renders the given range in the model as selected text.  This
 * is implemented to render the text in the color specified in
 * the hosting component.  It assumes the Highlighter will render
 * the selected background.  Uses the result of getEchoChar() to
 * @R_502_6422@play the characters.
 *
 * @param g the graphics context
 * @param x the starting X coordinate &gt;= 0
 * @param y the starting Y coordinate &gt;= 0
 * @param p0 the starting offset in the model &gt;= 0
 * @param p1 the ending offset in the model &gt;= p0
 * @return the X location of the end of the range &gt;= 0
 * @exception BadLocationException if p0 or p1 are out of range
 */
protected int drawSelectedText(Graphics g,int p1) throws BadLocationException {
    g.setColor(selected);
    Container c = getContainer();
    if (c instanceof jpasswordfield) {
        jpasswordfield f = (jpasswordfield) c;
        if (! f.echoCharIsSet()) {
            return super.drawSelectedText(g,p1);
        }
        char echoChar = f.getEchoChar();
        int n = p1 - p0;
        for (int i = 0; i < n; i++) {
            x = drawEchoCharacter(g,echoChar);
        }
    }
    return x;
}
项目:Openjsharp    文件PasswordView.java   
/**
 * Provides a mapping from the document model coordinate space
 * to the coordinate space of the view mapped to it.
 *
 * @param pos the position to convert &gt;= 0
 * @param a the allocated region to render into
 * @return the bounding Box of the given position
 * @exception BadLocationException  if the given position does not
 *   represent a valid location in the associated document
 * @see View#modelToView
 */
public Shape modelToView(int pos,Shape a,Position.Bias b) throws BadLocationException {
    Container c = getContainer();
    if (c instanceof jpasswordfield) {
        jpasswordfield f = (jpasswordfield) c;
        if (! f.echoCharIsSet()) {
            return super.modelToView(pos,a,b);
        }
        char echoChar = f.getEchoChar();
        FontMetrics m = f.getFontMetrics(f.getFont());

        Rectangle alloc = adjustAllocation(a).getBounds();
        int dx = (pos - getStartOffset()) * m.charWidth(echoChar);
        alloc.x += dx;
        alloc.width = 1;
        return alloc;
    }
    return null;
}
项目:Openjsharp    文件PasswordView.java   
/**
 * Provides a mapping from the view coordinate space to the logical
 * coordinate space of the model.
 *
 * @param fx the X coordinate &gt;= 0.0f
 * @param fy the Y coordinate &gt;= 0.0f
 * @param a the allocated region to render into
 * @return the location within the model that best represents the
 *  given point in the view
 * @see View#viewToModel
 */
public int viewToModel(float fx,float fy,Position.Bias[] bias) {
    bias[0] = Position.Bias.Forward;
    int n = 0;
    Container c = getContainer();
    if (c instanceof jpasswordfield) {
        jpasswordfield f = (jpasswordfield) c;
        if (! f.echoCharIsSet()) {
            return super.viewToModel(fx,fy,bias);
        }
        char echoChar = f.getEchoChar();
        int charWidth = f.getFontMetrics(f.getFont()).charWidth(echoChar);
        a = adjustAllocation(a);
        Rectangle alloc = (a instanceof Rectangle) ? (Rectangle)a :
                          a.getBounds();
        n = (charWidth > 0 ?
             ((int)fx - alloc.x) / charWidth : Integer.MAX_VALUE);
        if (n < 0) {
            n = 0;
        }
        else if (n > (getStartOffset() + getDocument().getLength())) {
            n = getDocument().getLength() - getStartOffset();
        }
    }
    return getStartOffset() + n;
}
项目:LANClipboard    文件EnterPassword.java   
public static String run() {    // SOURCE: https://goo.gl/5pFXao
    JPanel panel = new JPanel();
    JLabel label = new JLabel("This server is protected with a password.");
    jpasswordfield pass = new jpasswordfield(10);
    panel.add(label);
    panel.add(pass);
    String[] options = new String[]{"OK","Cancel"};
    int option = JOptionPane.showOptionDialog(null,"Enter password",JOptionPane.NO_OPTION,JOptionPane.PLAIN_MESSAGE,null,options,options[0]);
    if(option == 0) { // OK button
        char[] password = pass.getpassword();
        return new String(password);
    } else {
        return null;
    }
}
项目:jdk8u-jdk    文件PasswordView.java   
/**
 * Renders the given range in the model as normal unselected
 * text.  This sets the foreground color and echos the characters
 * using the value returned by getEchoChar().
 *
 * @param g the graphics context
 * @param x the starting X coordinate &gt;= 0
 * @param y the starting Y coordinate &gt;= 0
 * @param p0 the starting offset in the model &gt;= 0
 * @param p1 the ending offset in the model &gt;= p0
 * @return the X location of the end of the range &gt;= 0
 * @exception BadLocationException if p0 or p1 are out of range
 */
protected int drawUnselectedText(Graphics g,echoChar);
        }
    }
    return x;
}
项目:jdk8u-jdk    文件PasswordView.java   
/**
 * Renders the given range in the model as selected text.  This
 * is implemented to render the text in the color specified in
 * the hosting component.  It assumes the Highlighter will render
 * the selected background.  Uses the result of getEchoChar() to
 * @R_502_6422@play the characters.
 *
 * @param g the graphics context
 * @param x the starting X coordinate &gt;= 0
 * @param y the starting Y coordinate &gt;= 0
 * @param p0 the starting offset in the model &gt;= 0
 * @param p1 the ending offset in the model &gt;= p0
 * @return the X location of the end of the range &gt;= 0
 * @exception BadLocationException if p0 or p1 are out of range
 */
protected int drawSelectedText(Graphics g,echoChar);
        }
    }
    return x;
}
项目:jdk8u-jdk    文件PasswordView.java   
/**
 * Provides a mapping from the document model coordinate space
 * to the coordinate space of the view mapped to it.
 *
 * @param pos the position to convert &gt;= 0
 * @param a the allocated region to render into
 * @return the bounding Box of the given position
 * @exception BadLocationException  if the given position does not
 *   represent a valid location in the associated document
 * @see View#modelToView
 */
public Shape modelToView(int pos,b);
        }
        char echoChar = f.getEchoChar();
        FontMetrics m = f.getFontMetrics(f.getFont());

        Rectangle alloc = adjustAllocation(a).getBounds();
        int dx = (pos - getStartOffset()) * m.charWidth(echoChar);
        alloc.x += dx;
        alloc.width = 1;
        return alloc;
    }
    return null;
}
项目:jdk8u-jdk    文件PasswordView.java   
/**
 * Provides a mapping from the view coordinate space to the logical
 * coordinate space of the model.
 *
 * @param fx the X coordinate &gt;= 0.0f
 * @param fy the Y coordinate &gt;= 0.0f
 * @param a the allocated region to render into
 * @return the location within the model that best represents the
 *  given point in the view
 * @see View#viewToModel
 */
public int viewToModel(float fx,bias);
        }
        char echoChar = f.getEchoChar();
        int charWidth = f.getFontMetrics(f.getFont()).charWidth(echoChar);
        a = adjustAllocation(a);
        Rectangle alloc = (a instanceof Rectangle) ? (Rectangle)a :
                          a.getBounds();
        n = (charWidth > 0 ?
             ((int)fx - alloc.x) / charWidth : Integer.MAX_VALUE);
        if (n < 0) {
            n = 0;
        }
        else if (n > (getStartOffset() + getDocument().getLength())) {
            n = getDocument().getLength() - getStartOffset();
        }
    }
    return getStartOffset() + n;
}
项目:jdk8u-jdk    文件PasswordView.java   
/**
 * Determines the preferred span for this view along an
 * axis.
 *
 * @param axis may be either View.X_AXIS or View.Y_AXIS
 * @return   the span the view would like to be rendered into &gt;= 0.
 *           Typically the view is told to render into the span
 *           that is returned,although there is no guarantee.
 *           The parent may choose to resize or break the view.
 */
public float getPreferredSpan(int axis) {
    switch (axis) {
    case View.X_AXIS:
        Container c = getContainer();
        if (c instanceof jpasswordfield) {
            jpasswordfield f = (jpasswordfield) c;
            if (f.echoCharIsSet()) {
                char echoChar = f.getEchoChar();
                FontMetrics m = f.getFontMetrics(f.getFont());
                Document doc = getDocument();
                return m.charWidth(echoChar) * getDocument().getLength();
            }
        }
    }
    return super.getPreferredSpan(axis);
}
项目:openjdk-jdk10    文件PasswordView.java   
/**
 * Provides a mapping from the document model coordinate space
 * to the coordinate space of the view mapped to it.
 *
 * @param pos the position to convert &gt;= 0
 * @param a the allocated region to render into
 * @return the bounding Box of the given position
 * @exception BadLocationException  if the given position does not
 *   represent a valid location in the associated document
 * @see View#modelToView
 */
public Shape modelToView(int pos,b);
        }
        char echoChar = f.getEchoChar();
        FontMetrics m = f.getFontMetrics(f.getFont());

        Rectangle alloc = adjustAllocation(a).getBounds();
        int dx = (pos - getStartOffset()) * m.charWidth(echoChar);
        alloc.x += dx;
        alloc.width = 1;
        return alloc;
    }
    return null;
}
项目:polyevent    文件LoginView.java   
/**
 * Affiche les �lements graphiques sur la fen�tre
 */
private void afficher() {
    this.panPrinc = new JPanel();
    this.panPrinc.setLayout(new BoxLayout(this.panPrinc,BoxLayout.PAGE_AXIS));

    //Label identifiant
    JLabel labIdentifiant = new JLabel("Identifiant");
    labIdentifiant.setFont(new Font("Arial",20));
    labIdentifiant.setAlignmentX(Component.CENTER_ALIGNMENT);

    //Label mot de passe
    JLabel labMdp = new JLabel("Mot de passe");
    labMdp.setFont(new Font("Arial",20));
    labMdp.setAlignmentX(Component.CENTER_ALIGNMENT);

    //Champ de l'identifiant
    this.fieldName = new JTextField();
    this.fieldName.setPreferredSize(new Dimension(150,25));
    this.fieldName.setAlignmentX(Component.CENTER_ALIGNMENT);

    //Champ du mot de passe
    this.fieldPassword = new jpasswordfield();
    this.fieldPassword.setEchoChar('*');
    this.fieldPassword.setPreferredSize(new Dimension(150,25));
    this.fieldPassword.setAlignmentX(Component.CENTER_ALIGNMENT);

    //Bouton connecter
    butConnecter = new JButton();
    butConnecter.setAlignmentX(Component.CENTER_ALIGNMENT);

    this.panPrinc.add(Box.createVerticalStrut(180));
    this.panPrinc.add(labIdentifiant);
    this.panPrinc.add(this.fieldName);
    this.panPrinc.add(Box.createVerticalStrut(10));
    this.panPrinc.add(labMdp);
    this.panPrinc.add(this.fieldPassword);
    this.panPrinc.add(Box.createVerticalStrut(40));
    this.panPrinc.add(butConnecter);
}
项目:Dahlem_SER316    文件LoginDialogTest.java   
/**
 * Tests to ensure account is not generated when it shouldn't be. For
 * example: Differing passwords or account already exists. This does not
 * validate the account creation process details.
 */
@Test
public void testAccountCreation() {
    JTextField usernameField = dlg.getUsernameField();
    jpasswordfield passprimary = dlg.getpasswordFieldPrimary();
    jpasswordfield passverify = dlg.getpasswordFieldVerify();
    JButton button = dlg.getBtnCreateNewAccount();

    // Test account created no password
    usernameField.setText("heyTestGuy1");
    passprimary.setText("");
    passverify.setText("");
    button.doClick();
    assertTrue(AccountManager.userExists("heyTestGuy1"));

    // Test account NOT created - mismatched password
    usernameField.setText("heyTestGuy2");
    passprimary.setText("ardvark");
    passverify.setText("");
    button.doClick();
    assertFalse(AccountManager.userExists("heyTestGuy2"));

    //Test all correct values.
    usernameField.setText("heyTestGuy3");
    passprimary.setText("ardvark");
    passverify.setText("ardvark");
    button.doClick();
    assertTrue(AccountManager.userExists("heyTestGuy3"));

    assertTrue(AccountManager.removeUserAccount("heyTestGuy1"));
    assertTrue(AccountManager.removeUserAccount("heyTestGuy3"));
}
项目:jdigitalSimulator    文件Guitilities.java   
public static String showPasswordDialog(Component component,String text,String title) {
    jpasswordfield field = new jpasswordfield(); field.setEchoChar('\u25CF');
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel,BoxLayout.Y_AXIS));
    panel.add(createLabel(text));
    panel.add(field);
    if(JOptionPane.showConfirmDialog(component,title,JOptionPane.OK_CANCEL_OPTION)==JOptionPane.OK_OPTION)
        return new String(field.getpassword());
    else return null;
}
项目:openjdk-jdk10    文件jpasswordfieldOperator.java   
/**
 * Maps {@code jpasswordfield.setEchoChar(char)} through queue
 */
public void setEchoChar(final char c) {
    runMapping(new MapVoidAction("setEchoChar") {
        @Override
        public void map() {
            ((jpasswordfield) getSource()).setEchoChar(c);
        }
    });
}
项目:LivroJavaComoProgramar10Edicao    文件TextFieldFrame.java   
public TextFieldFrame()
{
   super("Testing JTextField and jpasswordfield");
   setLayout(new FlowLayout());

   // construct textfield with 10 columns
   textField1 = new JTextField(10); 
   add(textField1); // add textField1 to JFrame

   // construct textfield with default text
   textField2 = new JTextField("Enter text here");
   add(textField2); // add textField2 to JFrame

   // construct textfield with default text and 21 columns
   textField3 = new JTextField("Uneditable text field",21);
   textField3.setEditable(false); // @R_502_6422@able editing
   add(textField3); // add textField3 to JFrame

   // construct passwordfield with default text
   passwordField = new jpasswordfield("Hidden text");
   add(passwordField); // add passwordField to JFrame

   // register event handlers
   TextFieldHandler handler = new TextFieldHandler();
   textField1.addActionListener(handler);
   textField2.addActionListener(handler);
   textField3.addActionListener(handler);
   passwordField.addActionListener(handler);
}
项目:openjdk-jdk10    文件jpasswordfieldOperator.java   
/**
 * Maps {@code jpasswordfield.getpassword()} through queue
 */
public char[] getpassword() {
    return ((char[]) runMapping(new MapAction<Object>("getpassword") {
        @Override
        public Object map() {
            return ((jpasswordfield) getSource()).getpassword();
        }
    }));
}
项目:Hotel-Properties-Management-System    文件ChangePasswordWindow.java   
public void keyListenerForFields(jpasswordfield passwordField) {
    KeyAdapter myAdapter = new KeyAdapter() {

        @Override
        public void keyTyped(KeyEvent e) {
            infoLabel.setText(null);
            markerLbl.setVisible(false);
            super.keyTyped(e);
        }
    };
    passwordField.addKeyListener(myAdapter);
}
项目:Equella    文件ProxyDetailsDialog.java   
private void setupCredentials()
{
    JLabel usernameLabel = new JLabel("Username:");
    JLabel passwordLabel = new JLabel("Password:");

    usernameField = new JTextField();
    passwordField = new jpasswordfield();

    usernameField.addKeyListener(this);
    passwordField.addKeyListener(this);

    final int width1 = usernameLabel.getPreferredSize().width;
    final int width2 = passwordLabel.getPreferredSize().width;
    final int width3 = Math.max(width1,width2);
    final int height1 = usernameField.getPreferredSize().height;

    final int[] rows = {height1,height1};
    final int[] cols = {width3,TableLayout.FILL};

    credentials = new JGroup("Server requires authentication",false);
    credentials.addActionListener(this);
    credentials.setInnerLayout(new TableLayout(rows,cols));

    credentials.addInner(usernameLabel,new Rectangle(0,1,1));
    credentials.addInner(passwordLabel,1));
    credentials.addInner(usernameField,new Rectangle(1,1));
    credentials.addInner(passwordField,1));

    credentials.setSelected(false);
}
项目:Dahlem_SER316    文件LoginDialog.java   
/**
 * Occurs when sign in button is pressed and then utilizes the account
 * manager to verify the name and password fields match their respective
 * account file.
 */
protected void loginToAccount() {
    JTextField name = getUsernameField();
    jpasswordfield pw = getpasswordFieldPrimary();
    if (AccountManager.verifyAccountHashedPassword(name.getText(),String.valueOf(pw.getpassword()))) {
        App.showWindow();
        this.@R_502_6422@pose();
    } else {
        errorLabel.setText("Failed to log in.");
        errorLabel.setForeground(Color.red);
    }
    repaint();
}
项目:Equella    文件EQUELLAPlugin.java   
@Override
public void initGUI()
{
    userField = new JTextField();
    passField = new jpasswordfield();

    serverField = new JTextField();

    liveOnly = new JCheckBox();

    collectionField = new JComboBox<NameValue>();
    collectionField.setEditable(false);

    JButton getCollections = new JButton(s("getcollections"));
    getCollections.addActionListener(this);

    final int width = getCollections.getPreferredSize().width;
    final int height = getCollections.getPreferredSize().height;

    final int[] rows = {height};
    final int[] cols = new int[]{TableLayout.FILL,width};

    JPanel collPanel = new JPanel();
    collPanel.setLayout(new TableLayout(rows,cols,5,5));

    collPanel.add(collectionField,1));
    collPanel.add(getCollections,1));

    panel.addComponent(new JLabel(s("settings")));

    panel.addNameAndComponent(s("server"),serverField);

    panel.addNameAndComponent(getString("detailstab.user"),passField);

    panel.addNameAndComponent(s("remotecollection"),collPanel);
    panel.addNameAndComponent(s("live"),liveOnly);
}
项目:Equella    文件CanvasSettingsPanel.java   
protected void setupGui()
{
    final JLabel canvasUrlLabel = new JLabel(getString("label.canvasurl"));
    final JLabel clientIdLabel = new JLabel(getString("label.clientid"));
    final JLabel secretLabel = new JLabel(getString("label.secret"));
    preamble = new JLabel(getString("preamble",CANVAS_SIGNUP_URL));
    preamble.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    preamble.addMouseListener(this);

    canvasUrl = new JTextField(20);
    clientId = new JTextField(20);
    secret = new jpasswordfield(20);
    bypasslogon = new JCheckBox();
    bypasslogon.setText(getString("label.bypasslogon"));

    final LayoutManager layout = new MigLayout("wrap","[fill][fill,grow]");
    setLayout(layout);

    setBorder(BorderFactory.createEmptyBorder(5,5));

    add(preamble,"span 2,gapbottom 20");
    add(canvasUrlLabel);
    add(canvasUrl);
    add(clientIdLabel);
    add(clientId);
    add(secretLabel);
    add(secret);
    add(bypasslogon,"span 2");

    validate();
}
项目:ramus    文件AttributeEditorDialog.java   
private void setEditsAction(final Container con) {
      if (con instanceof JSpinner)
          return;

/*
       * if(con instanceof JSplitPane){
 * setEditsAction(((JSplitPane)con).getLeftComponent());
 * setEditsAction(((JSplitPane)con).getRightComponent()); return; }
 */

      for (int i = 0; i < con.getComponentCount(); i++) {
          if (con.getComponent(i) instanceof Container)
              setEditsAction((Container) con.getComponent(i));
          final Component container = con.getComponent(i);
          if (container instanceof JTextField) {
              ((JTextField) container).addActionListener(listener);
          } else if (container instanceof jpasswordfield) {
              ((jpasswordfield) container).addActionListener(listener);
          }

          if (container instanceof JList
                  && !(container instanceof jtableheader)) {
              ((JList) container).addMouseListener(new MouseAdapter() {

                  @Override
                  public void mouseClicked(final MouseEvent e) {
                      if (e.getButton() == MouseEvent.BUTTON1
                              && e.getClickCount() > 1)
                          panel.ok();
                  }

              });
          }
      }
  }
项目:ramus    文件BaseDialog.java   
private void setEditsAction(final Container con) {
      if (con instanceof JSpinner)
          return;

/*
       * if(con instanceof JSplitPane){
 * setEditsAction(((JSplitPane)con).getLeftComponent());
 * setEditsAction(((JSplitPane)con).getRightComponent()); return; }
 */

      for (int i = 0; i < con.getComponentCount(); i++) {
          if (con.getComponent(i) instanceof Container)
              setEditsAction((Container) con.getComponent(i));
          final Component container = con.getComponent(i);
          if (container instanceof JTextField) {
              processtextField((JTextField) container);
          } else if (container instanceof jpasswordfield) {
              ((jpasswordfield) container).addActionListener(listener);
          }
          if (container instanceof JTextComponent) {
              addUndoFunctions((JTextComponent) container);
          }
          if (container instanceof JList
                  && !(container instanceof jtableheader)) {
              ((JList) container).addMouseListener(new MouseAdapter() {

                  @Override
                  public void mouseClicked(final MouseEvent e) {
                      if (e.getButton() == MouseEvent.BUTTON1
                              && e.getClickCount() > 1)
                          onOk();
                  }

              });
          }
      }
  }
项目:ramus    文件BaseDialog.java   
private void setEditsAction(final Container con) {
      if (con instanceof JSpinField)
          return;

/*
       * if(con instanceof JSplitPane){
 * setEditsAction(((JSplitPane)con).getLeftComponent());
 * setEditsAction(((JSplitPane)con).getRightComponent()); return; }
 */

      for (int i = 0; i < con.getComponentCount(); i++) {
          if (con.getComponent(i) instanceof Container)
              setEditsAction((Container) con.getComponent(i));
          final Component container = con.getComponent(i);
          if (container instanceof JTextField) {
              processtextField((JTextField) container);
          } else if (container instanceof jpasswordfield) {
              ((jpasswordfield) container).addActionListener(listener);
          }
          if (container instanceof JTextComponent) {
              addUndoFunctions((JTextComponent) container);
          }
          if (container instanceof JList
                  && !(container instanceof com.ramussoft.gui.qualifier.table.TableRowHeader)) {
              ((JList) container).addMouseListener(new MouseAdapter() {

                  @Override
                  public void mouseClicked(final MouseEvent e) {
                      if (e.getButton() == MouseEvent.BUTTON1
                              && e.getClickCount() > 1)
                          onOk();
                  }

              });
          }
      }
  }
项目:BachSys    文件TelaCadastroUsuario.java   
@Override
public void construirTela(){

    lbUsuario = new JLabel("Usuário:");
    adicionarComponente(lbUsuario,GridBagConstraints.CENTER,GridBagConstraints.HORIZONTAL,1);
    lbEmail = new JLabel("E-mail:");
    adicionarComponente(lbEmail,GridBagConstraints.NONE,1);
    lbSenha = new JLabel("Senha:");
    adicionarComponente(lbSenha,2,1);
    lbConfirmarSenha = new JLabel("Confirmar Senha:");
    adicionarComponente(lbConfirmarSenha,1);

    txtUsuario = new JTextField(10);
    adicionarComponente(txtUsuario,3,1);
    txtEmail = new JTextField(10);
    adicionarComponente(txtEmail,1);
    txtSenha = new jpasswordfield(10);
    adicionarComponente(txtSenha,1);
    txtConfirmarSenha = new jpasswordfield(10);
    adicionarComponente(txtConfirmarSenha,1);

    btnCancelar = new JButton("Cancelar");        
    btnRegistrar = new JButton("Enviar");

    painelBotoes = new JPanel();
    painelBotoes.add(btnCancelar);
    painelBotoes.add(btnRegistrar);
    adicionarComponente(painelBotoes,4,1);


}
项目:openjdk-jdk10    文件jpasswordfieldOperator.java   
@Override
public Hashtable<String,Object> getDump() {
    Hashtable<String,Object> result = super.getDump();
    result.put(ECHO_CHAR_DPROP,Character.toString(((jpasswordfield) getSource()).getEchoChar()));
    return result;
}
项目:Openjsharp    文件XTextFieldPeer.java   
@Override
protected String getPropertyPrefix() {
    JTextComponent comp = getComponent();
    if (comp instanceof jpasswordfield && ((jpasswordfield)comp).echoCharIsSet()) {
        return "PasswordField";
    } else {
        return "TextField";
    }
}
项目:jdk8u-jdk    文件XTextFieldPeer.java   
@Override
protected String getPropertyPrefix() {
    JTextComponent comp = getComponent();
    if (comp instanceof jpasswordfield && ((jpasswordfield)comp).echoCharIsSet()) {
        return "PasswordField";
    } else {
        return "TextField";
    }
}
项目:openjdk-jdk10    文件jpasswordfieldOperator.java   
/**
 * Maps {@code jpasswordfield.echoCharIsSet()} through queue
 */
public boolean echoCharIsSet() {
    return (runMapping(new MapBooleanAction("echoCharIsSet") {
        @Override
        public boolean map() {
            return ((jpasswordfield) getSource()).echoCharIsSet();
        }
    }));
}
项目:openjdk-jdk10    文件PasswordView.java   
@SuppressWarnings("deprecation")
private float drawUnselectedTextImpl(Graphics g,float x,float y,int p1,boolean useFPAPI)
        throws BadLocationException
{
    Container c = getContainer();
    if (c instanceof jpasswordfield) {
        jpasswordfield f = (jpasswordfield) c;
        if (!f.echoCharIsSet()) {
            boolean useDrawUnselectedFPAPI = useFPAPI
                    && drawUnselectedTextOverridden
                    && g instanceof Graphics2D;
            return (useDrawUnselectedFPAPI )
                    ? super.drawUnselectedText((Graphics2D) g,p1)
                    : super.drawUnselectedText(g,(int) x,(int) y,p1);
        }
        if (f.isEnabled()) {
            g.setColor(f.getForeground());
        }
        else {
            g.setColor(f.get@R_502_6422@abledTextColor());
        }
        char echoChar = f.getEchoChar();
        int n = p1 - p0;
        boolean useEchoCharFPAPI = useFPAPI
                && drawEchoCharacterOverridden
                && g instanceof Graphics2D;
        for (int i = 0; i < n; i++) {
            x = (useEchoCharFPAPI)
                    ? drawEchoCharacter((Graphics2D) g,echoChar)
                    : drawEchoCharacter(g,echoChar);
        }
    }
    return x;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。