Package swing.panel

Source Code of swing.panel.PasswordFieldPanel

/*
* PasswordPanel.java
*
* Created on 2009. oktober 22., 9:33
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package swing.panel;

import java.awt.GridBagLayout;
import java.awt.event.FocusListener;
import java.util.Vector;
import javax.swing.JPasswordField;
import javax.swing.event.DocumentListener;
import swing.form.FormUtil;
import system.util.FieldValidator;
import system.util.Login;

/**
*
* @author laci
*/
public class PasswordFieldPanel extends Panel{
 
// <editor-fold defaultstate="collapsed" desc="Konstansok">
 
  public static final int DEFAULT_LENGTH = 10;
 
// </editor-fold>
 
// <editor-fold defaultstate="collapsed" desc="konstruktor">
  public PasswordFieldPanel(Login login) {
    super(login, new GridBagLayout());
    initialize("",DEFAULT_LENGTH);
  }

  public PasswordFieldPanel(Login login, String title) {
    super(login, new GridBagLayout());
    initialize(title,DEFAULT_LENGTH);
  }
 
  public PasswordFieldPanel(Login login, String title, int length) {
    super(login, new GridBagLayout());
    initialize(title,length);
  }
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="inicializalas">

  public void initialize(String title, int length) {
    setTitle(title);
    getPasswordField().setColumns(length);
    createLayout();
  }

// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="fokusz order">
  /** Fokusz sorrend beallitasa */
  protected Vector getFocusOrder() {
    return new Vector();
  }

// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="createLayout">

  public void createLayout() {
    setLayout(new GridBagLayout());
    add(getTitle(), FormUtil.newGBConstraints(0, 0, 1, 1, FormUtil.ANCHOR_WEST, FormUtil.FILL_NONE, null));
    add(getPasswordField(), FormUtil.newGBConstraints(1, 0, 1, 1, FormUtil.ANCHOR_WEST, FormUtil.FILL_NONE, null));
  }

// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="enabler">
  /** Formon levo mezok tiltasara, engedelyezesere szolgal. */
  public void setEnabled(boolean mire) {
    getPasswordField().setEnabled(mire);
  }

// </editor-fold>
 
// <editor-fold defaultstate="collapsed" desc="mezo">
 
  private JPasswordField passwordField;
 
  protected JPasswordField getPasswordField() {
    if (passwordField == null) {
      passwordField = createPasswordField();
    }
   
    return passwordField;
  }
 
  protected JPasswordField createPasswordField() {
    JPasswordField temp = new JPasswordField();
   
    return temp;
  }
 
  public String getText() {
    return FieldValidator.getString(getPasswordField().getText());
  }
 
  public void setText(String mire) {
    getPasswordField().setText(mire);
  }
 
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="kitolt">
  /** Kepernyo kitoltese */
  protected void fill() {

  }

// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="reszet">
  /** Kepernyo torlese */
  protected void reset() {
   
  }
// </editor-fold>
 
// <editor-fold defaultstate="collapsed" desc="focuslistener">
 
    public synchronized void addFocusListener(FocusListener l) {
        if (l == null) {
            return;
        }
    this.getPasswordField().addFocusListener(l);
    }

 
// </editor-fold>
 
// <editor-fold defaultstate="collapsed" desc="Doksi listener">
 
  public void addDocumentListener(DocumentListener l) {
    getPasswordField().getDocument().addDocumentListener(l);
  }
 
// </editor-fold>
 
}
TOP

Related Classes of swing.panel.PasswordFieldPanel

TOP
Copyright © 2018 www.massapi.com. 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.