Package com.aesthete.swingobjects.showcase

Source Code of com.aesthete.swingobjects.showcase.LogonFrameLayout

package com.aesthete.swingobjects.showcase;

import java.util.HashMap;

import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JTextField;

import com.aesthete.swingobjects.fw.common.util.CsmartFormBuilder;
import com.aesthete.swingobjects.fw.common.util.CsmartFormBuilder.ButtonBarPos;
import com.aesthete.swingobjects.ui.common.util.CommonComponentFactory;
import com.jgoodies.forms.layout.FormLayout;

public class LogonFrameLayout extends JFrame{

  protected HashMap<Object, JComponent> compMap = new HashMap<Object, JComponent>();

  public enum LogonFrameConstants{USERID,PASSWORD,LOGON};

  protected JTextField tfUserId;
  protected JTextField tfPassword;
  protected JButton btnLogon;

  protected void layoutComponents() {
    FormLayout layout = new FormLayout("10dlu,pref,10dlu,100dlu,10dlu", "");
    CsmartFormBuilder builder = new CsmartFormBuilder(layout);
    builder.addComponentsToCenter(null,3,2,CommonComponentFactory.getBoldLabel("logonpanel.logontext1"));
    builder.nextLine();
    builder.addComponentsToCenter(null,3,2,CommonComponentFactory.getBoldLabel("logonpanel.logontext2"));
    builder.nextLine();
    builder.addLblKeyAndComp("logonpanel.userid",tfUserId);
    builder.nextLine();
    builder.addLblKeyAndComp("logonpanel.pass",tfPassword);
    builder.addButtonBar(3, ButtonBarPos.Center, null, btnLogon);
    builder.complete();
    this.setContentPane(builder.getPanel());
  }

  protected void populateCompMap() {
    compMap.put(LogonFrameConstants.USERID, tfUserId);
    compMap.put(LogonFrameConstants.PASSWORD, tfPassword);
    compMap.put(LogonFrameConstants.LOGON, btnLogon);
  }

  public HashMap<Object, JComponent> getCompMap() {
    return compMap;
  }

  public void setCompMap(HashMap<Object, JComponent> compMap) {
    this.compMap = compMap;
  }
}
TOP

Related Classes of com.aesthete.swingobjects.showcase.LogonFrameLayout

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.