Package com.zycus.dotproject.util

Source Code of com.zycus.dotproject.util.LoginHandler

package com.zycus.dotproject.util;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.WindowConstants;

import com.zycus.dotproject.ui.IconHelper;
import com.zycus.dotproject.ui.LoginScreen;


public final class LoginHandler {

  private static LoginHandler loginHandler = null;
 
  private LoginHandler() {}
 
  public static synchronized LoginHandler getDefault()
  {
    if (loginHandler == null) {
      loginHandler = new LoginHandler();
    }
   
    return loginHandler;
  }
 
  public boolean performLogin() {
    JDialog dlgLogin = new JDialog(new JFrame(), "Login");
    dlgLogin.setIconImage(IconHelper.getProductLogoImage());
    LoginScreen loginScreen = new LoginScreen(dlgLogin);
    dlgLogin.add(loginScreen);
    dlgLogin.setModal(true);
    try
    {
        UIManager.setLookAndFeel(ApplicationContext.getCurrentLookAndFeel().getClassName());
      SwingUtilities.updateComponentTreeUI(dlgLogin);
    }
    catch(Exception excp)
    {
        System.out.println(excp);
    }
    dlgLogin.pack();
    dlgLogin.setLocationRelativeTo(null);
    dlgLogin.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    dlgLogin.setVisible(true);   
    return loginScreen.getLoginStatus();
  }
}
TOP

Related Classes of com.zycus.dotproject.util.LoginHandler

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.