首页>代码>JAVACV人脸识别代码下载 酷~~>/FaceRecTest/src/test/RegisterShell.java
package test;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.widgets.Display;



import com.googlecode.javacv.FrameGrabber.Exception;


public class RegisterShell {

	public static Shell sShell = null;  //  @jve:decl-index=0:visual-constraint="10,10"
	private Label label_User = null;
	private Button button_Next = null;
	public static Text text_User = null;
	private Label label = null;
	private Label labelTip = null;
	public RegisterShell(){
		createSShell();
	}
	
	public Shell getShell()
	{
		
		return sShell;
	}
	/**
	 * This method initializes sShell
	 */
	private void createSShell() {
		sShell = new Shell();
		sShell.setText("BP_FaceRecognizer_Register");
		sShell.setSize(new Point(533, 317));
		sShell.setLayout(null);
		label_User = new Label(sShell, SWT.NONE);
		label_User.setText("输入用户名:");
		label_User.setFont(new Font(Display.getDefault(), "宋体", 10, SWT.NORMAL));
		label_User.setBounds(new Rectangle(122, 67, 85, 25));
		button_Next = new Button(sShell, SWT.NONE);
		button_Next.setBounds(new Rectangle(114, 140, 297, 42));
		button_Next.setText("下一步");
		
		labelTip = new Label(getShell(), SWT.NONE);
		labelTip.setBounds(new Rectangle(111, 210, 380, 80));
		labelTip.setFont(new Font(Display.getDefault(), "宋体", 10, SWT.NORMAL));
		labelTip.setText("如果想删除已注册的用户:1.将data中的Fortraining.txt打开,\n清空并保存" +
				"\n2.将data中的facedata.xml用记事本打开,\n清空,留下第一行<?xml version=?>并保存");
		
		
		text_User = new Text(sShell, SWT.BORDER);
		text_User.setBounds(new Rectangle(239, 67, 168, 30));
		label = new Label(getShell(), SWT.NONE);
		label.setBounds(new Rectangle(111, 118, 350, 80));
		label.setFont(new Font(Display.getDefault(), "宋体", 12, SWT.NORMAL));
		label.setText("请不要输入已存在的用户名且用户名不要带空格");
		button_Next.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
			public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
					String userName=RegisterShell.text_User.getText();
					if(userName.isEmpty()==false)
					{
						FaceRecognizer fr=new FaceRecognizer();
						try 
						{
							fr.register(userName);
							LoginShell displayshell=new LoginShell();
							Shell newShell= displayshell.getShell();
							Shell oldShell=RegisterShell.sShell;
							RegisterShell.sShell=newShell;
							RegisterShell.sShell.open();
							oldShell.dispose();
						}
						catch (Exception e1) 
						{
							e1.printStackTrace();
						}
					}
			}
		});
	
	}

}
最近下载更多
tdcq123  LV14 2024年3月22日
c15042361021  LV4 2022年11月8日
陆羽  LV5 2022年9月27日
yanxiaojie  LV3 2021年9月29日
whfuai  LV14 2021年8月19日
rruizy  LV3 2021年6月30日
你是傻子  LV9 2021年5月24日
iRichard1314  LV6 2021年5月16日
liu3987741  LV8 2021年4月6日
秦峯123456  LV4 2021年3月24日
最近浏览更多
vincemokea  LV9 2025年9月14日
lipanlong  LV10 2024年12月3日
897258976  LV8 2024年8月29日
疯狂小太阳 2024年6月18日
暂无贡献等级
8520963  LV1 2024年6月4日
微笑刺客  LV21 2024年5月30日
wwswdgyqd  LV6 2024年5月10日
tdcq123  LV14 2024年3月22日
鸦葱  LV4 2024年1月6日
sky丶小十  LV7 2023年12月18日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友