コード例 #1
0
 public JPasswordField getSenhaField() {
   if (senhaField == null) {
     senhaField = new JPasswordField();
     int strSize = 50;
     senhaField.setDocument(new TextDocument(strSize));
     senhaField.setToolTipText("Informe a nova senha");
     senhaField.setColumns(10);
   }
   return senhaField;
 }
コード例 #2
0
ファイル: SQLPanel.java プロジェクト: jbudynk/starjava
 /**
  * Initialises this dialog's fields in accordance with a given JDBCAuthenticator object. In
  * general, this will call {@link uk.ac.starlink.table.jdbc.JDBCAuthenticator#authenticate} and
  * fill the user and password fields with the result. However, if <code>auth</code> is a {@link
  * uk.ac.starlink.table.jdbc.TextModelsAuthenticator}, it will actually use its models in the user
  * and password fields.
  *
  * @param auth authenticator object to configure from
  */
 public void useAuthenticator(JDBCAuthenticator auth) {
   if (auth instanceof TextModelsAuthenticator) {
     TextModelsAuthenticator tAuth = (TextModelsAuthenticator) auth;
     userField.setDocument(tAuth.getUserDocument());
     passField.setDocument(tAuth.getPasswordDocument());
   } else {
     if (auth instanceof SwingAuthenticator) {
       ((SwingAuthenticator) auth).setParentComponent(this);
     }
     try {
       String[] up = auth.authenticate();
       userField.setText(up[0]);
       passField.setText(up[1]);
     } catch (IOException e) {
       logger_.log(Level.WARNING, "Authentication attempt failed", e);
     }
   }
 }
コード例 #3
0
ファイル: AddEditUsers.java プロジェクト: sks40gb/zunk
  /** Add ui controls */
  private void addControls() {
    unitizeCheckBox = new JCheckBox("Unitize");
    unitizeCheckBox.addActionListener(buttonComboListener);
    uqcCheckBox = new JCheckBox("Unitize QC");
    uqcCheckBox.addActionListener(buttonComboListener);
    codingCheckBox = new JCheckBox("Coding");
    codingCheckBox.addActionListener(buttonComboListener);
    codingqcCheckBox = new JCheckBox("Coding QC");
    codingqcCheckBox.addActionListener(buttonComboListener);
    qaCheckBox = new JCheckBox("QA");
    qaCheckBox.addActionListener(buttonComboListener);
    listingCheckBox = new JCheckBox("Listing");
    listingCheckBox.addActionListener(buttonComboListener);
    tallyCheckBox = new JCheckBox("Tally");
    tallyCheckBox.addActionListener(buttonComboListener);
    tlCheckBox = new JCheckBox("Team Leader");
    tlCheckBox.addActionListener(buttonComboListener);
    adminCheckBox = new JCheckBox("Admin");
    adminCheckBox.addActionListener(buttonComboListener);
    teamsCombo.addActionListener(buttonComboListener);

    adminUsersCheckBox = new JCheckBox("Users");
    adminUsersCheckBox.addActionListener(buttonComboListener);
    adminProjectCheckBox = new JCheckBox("Project");
    adminProjectCheckBox.addActionListener(buttonComboListener);
    adminBatchCheckBox = new JCheckBox("Batch");
    adminBatchCheckBox.addActionListener(buttonComboListener);
    adminEditCheckBox = new JCheckBox("Global Edit");
    adminEditCheckBox.addActionListener(buttonComboListener);
    adminImportCheckBox = new JCheckBox("Import");
    adminImportCheckBox.addActionListener(buttonComboListener);
    adminExportCheckBox = new JCheckBox("Export");
    adminExportCheckBox.addActionListener(buttonComboListener);
    adminProfitCheckBox = new JCheckBox("Profit");
    adminProfitCheckBox.addActionListener(buttonComboListener);

    userName = new LTextField(40);
    fname = new LTextField(40);
    lname = new LTextField(40);
    team = new LTextField(40);
    userName.setDocument(getUpperPlainDocument());
    userName.setToolTipText("User Id may contain only letters and digits.");
    fname.setDocument(getPlainDocument());
    lname.setDocument(getPlainDocument());

    JLabel seperator_lbl_1 = new JLabel("    ");
    JLabel seperator_lbl_2 = new JLabel("    ");
    JLabel seperator_lbl_3 = new JLabel("    ");

    password = new JPasswordField(32);
    confirmPassword = new JPasswordField(32);
    password.setDocument(getPlainDocument());
    confirmPassword.setDocument(getPlainDocument());

    dateField.getComponent(1).setMaximumSize(new Dimension(50, 20));
    field = (JTextField) dateField.getComponent(0);
    field.setColumns(10);
    dateField.addPropertyChangeListener(
        new java.beans.PropertyChangeListener() {

          public void propertyChange(java.beans.PropertyChangeEvent evt) {
            // dateFieldPropertyChange(evt);
          }
        });

    // internal_volume_namePanel.add(dateField);

    rolePane.add(unitizeCheckBox);
    rolePane.add(uqcCheckBox);
    rolePane.add(codingCheckBox);
    rolePane.add(codingqcCheckBox);
    rolePane.add(listingCheckBox);
    rolePane.add(tallyCheckBox);
    rolePane.add(qaCheckBox);
    rolePane.add(tlCheckBox);
    rolePane.add(adminCheckBox);

    namePane.add(0, 0, "User Id:", userName);
    namePane.add(0, 1, "", new Label());
    namePane.add(0, 2, "First Name:", fname);
    namePane.add(0, 3, "", new Label());
    namePane.add(0, 4, "Last Name:", lname);
    namePane.add(0, 5, "", new Label());
    namePane.add(0, 6, "Join Date:", dateField);
    namePane.add(0, 7, "Roles:", rolePane);
    namePane.add(0, 8, "Admin:", adminPrivPane);
    namePane.add(0, 9, "Team:", teamsCombo);
    namePane.add(0, 10, "", seperator_lbl_1);
    namePane.add(0, 11, "Password:"******"", seperator_lbl_2);
    namePane.add(0, 13, "Confirm Password:"******"", seperator_lbl_3);

    adminPrivPane.add(adminUsersCheckBox);
    adminPrivPane.add(adminProjectCheckBox);
    adminPrivPane.add(adminBatchCheckBox);
    adminPrivPane.add(adminEditCheckBox);
    adminPrivPane.add(adminImportCheckBox);
    adminPrivPane.add(adminExportCheckBox);
    adminPrivPane.add(adminProfitCheckBox);

    selectPanel.add(namePane, BorderLayout.CENTER);
    pack();
  }
コード例 #4
0
ファイル: MainScreenMig.java プロジェクト: oerl/UniMeet-gu.se
  public void initial() {
    // J:set up the frame
    window = new JFrame("UniMeet");

    // J:the content panel, using MigLayout("layout constraint",
    // "column constraint", "row constraint");
    JPanel Panel = new JPanel(new MigLayout("", "[315!] 10 [350!]", "10 [] 10"));

    // J:Divide the content panel into two panels, logPanel and signPanel
    JPanel LogPanel = new JPanel(new MigLayout("wrap 2, gapy 10", "0 [152!] 1 [152!] 10", ""));
    JPanel signPanel = new JPanel(new MigLayout("wrap 2, gapy 5", "0 [151!] 3 [151!] 45", ""));

    /** * Log In Panel * * */

    // J:The logo consists of two parts because there are two fonts used
    // here.
    Logo = new JLabel("Uni");
    Logo2 = new JLabel("Meet");
    Logo.setFont(new Font("Serif", Font.ITALIC, 35));
    Logo.setForeground(Color.BLUE);
    Logo2.setFont(new Font("TimesRoman-Bold", Font.ITALIC, 35));
    Logo2.setForeground(Color.DARK_GRAY);
    LogPanel.add(Logo, "align right");
    LogPanel.add(Logo2, "align left");

    // J:add the slogan below the logo
    Slogan = new JLabel("To easily find new friends in Universities");
    Slogan.setFont(new Font("TimesRoman", Font.ITALIC, 15));
    Slogan.setForeground(Color.DARK_GRAY);
    LogPanel.add(Slogan, "span 2, align 50% 50%");

    LogIn = new JLabel("Log In Here");
    LogIn.setFont(new Font("Helvetica", Font.PLAIN, 20));
    LogIn.setForeground(Color.BLUE);
    // J:"skip 2" is to skip two components, which is a row.
    LogPanel.add(LogIn, "span 2, align 50% 50%, skip 2");

    // J: instead of having separate JLabel and JTextField, I used
    // TitleBorder.
    // J: (applies also to password TextField)
    emailF = new JTextField(15);
    Border blueline = BorderFactory.createLineBorder(Color.blue);
    emailF.setBorder(BorderFactory.createTitledBorder(blueline, "Student Email"));
    emailF.setBackground(null);
    LogPanel.add(emailF, "span 2, grow, h 45!, w :270:290");
    // **emailF.setDocument(new LimitCharactersInput(30));

    passF = new JPasswordField(10);
    passF.setBorder(BorderFactory.createTitledBorder(blueline, "Password"));
    passF.setBackground(null);
    LogPanel.add(passF, "span 2, grow, h 45!, w :270:290");
    // **passF.setDocument(new LimitCharactersInput(15));

    cantAccess = new JButton("Can't Access your Account?");
    cantAccess.setBorderPainted(false);
    LogPanel.add(cantAccess, "span 2, w :100:, align right, push");

    loginButton = new JButton("Log in");
    LogPanel.add(loginButton, "skip 1, w :100:, align right, push");

    // J:add the login button's function and 'can't access?'button's
    // function

    logButtonFunctions();

    // J:add LogPanel to the content panel.
    Panel.add(LogPanel);

    /** * Sign Up Panel* * */
    dateChooser.setVisible(true);

    // J:add a simple sign up label
    SignUp = new JLabel("Sign Up Now!");
    SignUp.setFont(new Font("Helvetica", Font.PLAIN, 20));
    SignUp.setForeground(Color.DARK_GRAY);
    signPanel.add(SignUp, "span 2, align 50% 50%, aligny baseline");

    // J:TextField for first name and last name
    fName = new JTextField(10);
    Border Grayline = BorderFactory.createLineBorder(Color.GRAY);
    fName.setBorder(BorderFactory.createTitledBorder(Grayline, "First Name"));
    fName.setBackground(Color.WHITE);
    signPanel.add(fName, "skip 4, span 2, h 40!, grow");
    fName.setDocument(new LimitCharactersInput(15));

    lName = new JTextField(10);
    lName.setDocument(new LimitCharactersInput(15));
    lName.setBorder(BorderFactory.createTitledBorder(Grayline, "Last Name"));
    lName.setBackground(Color.WHITE);
    signPanel.add(lName, "span 2, h 40!, grow");

    emailSign = new JTextField(15);
    emailF.setDocument(new LimitCharactersInput(30));
    emailSign.setBorder(BorderFactory.createTitledBorder(Grayline, "Student Email"));
    emailSign.setBackground(Color.WHITE);
    signPanel.add(emailSign, "h 40!, grow, span 2");

    passwordSign = new JPasswordField(10);
    passwordSign.setDocument(new LimitCharactersInput(15));
    passwordSign.setBorder(BorderFactory.createTitledBorder(Grayline, "Password"));
    passwordSign.setBackground(Color.WHITE);
    signPanel.add(passwordSign, "h 40!, grow, span 2");

    // J: if we want to add a re-type password Field:

    // passwordSign2 = new JPasswordField(10);
    // //***passwordF.setDocument(new LimitCharactersInput(15));
    // passwordSign2.setBorder(BorderFactory.createTitledBorder(
    // Grayline, "Re-type Password"));
    // passwordSign2.setBackground(Color.WHITE);
    // signPanel.add(passwordSign2, "h 40!, grow, span 2");

    birthday = new JLabel("Birthday");
    signPanel.add(birthday, "split 2");
    signPanel.add(dateChooser, "");
    dateChooser.setDateFormatString("yyyy-MM-dd");

    male = new JRadioButton("Male");
    female = new JRadioButton("Female");
    group = new ButtonGroup();
    group.add(male);
    group.add(female);
    signPanel.add(male, "split 2");
    signPanel.add(female);

    signupButton = new JButton("Sign Up!");
    signPanel.add(signupButton, "skip 7, w :100:, align right");

    Panel.add(signPanel);

    try {
      signButtonFunctions();
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    window.add(Panel);
    window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    window.setVisible(true);
    window.setSize(685, 400);
    window.setLocationRelativeTo(null);
    MigLayout layout = new MigLayout("nogrid");
    window.setLayout(layout);
  }