⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 checkspkeypanel.java

📁 打印管理程序,测试完全通过.windows开发环境.
💻 JAVA
字号:
package jp.co.ntl.swing.ext.cppuser;

import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JButton;

import jp.co.ntl.Net;
import jp.co.ntl.NetworkException;
import jp.co.ntl.NoUSBException;
import jp.co.ntl.ServerException;
import jp.co.ntl.TimeOutException;

import jp.co.ntl.swing.BasePanel;
import jp.co.ntl.swing.ext.DialogManager;
import jp.co.ntl.cppuser.CPPUserInfo;

public class CheckSPKeyPanel extends BasePanel implements ActionListener {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private JLabel				lblMsg;
	private JButton			btnNext;
	
	private CPPUserInfo		userInfo;
	private CPPUserInvoker		invoker;
	
	public CheckSPKeyPanel(JFrame parent, Net net) {
		super(parent, net);
	}
	
	public CheckSPKeyPanel(JApplet app, Net net) {
		super(app, net);
	}
	
	protected void buildComponents() {
		invoker = CPPUserInvoker.getInstance(net);
		userInfo = new CPPUserInfo();
		
		lblMsg = new JLabel(Resource.getString(Resource.CHECK_SP_KEY_PANEL_MESSAGE), JLabel.CENTER);
		lblMsg.setFont(new Font(null, Font.BOLD, 24));
		add(lblMsg, BorderLayout.CENTER);

		btnNext = new JButton(Resource.getString(Resource.NEXT));
		
		addButtonPanel(new JButton[] {btnNext}, new String[] {null});
		
		btnNext.addActionListener(this);
		
		beginPanel();
	}

	public void beginPanel() {
	}
	
	protected boolean doRegister() throws NetworkException, ServerException, TimeOutException {
		return true;
	}
	
	protected boolean doModify() throws NetworkException, ServerException, TimeOutException {
		return true;
	}
	
	protected boolean doDelete() throws NetworkException, ServerException, TimeOutException {
		return true;
	}
	
	protected void setPopupMenuState() {
	}
	
	public int getInfosFromServer() {
		return GET_INFO_RESULT_NORMAL;
	}
	
	private int checkUSBKey(CPPUserInfo userInfo) {
		int			userKind = CPPUserInvoker.ERROR_OTHER;
		
		try {
			userKind = invoker.checkAdmin(userInfo);
		} catch (NoUSBException e) {
///			DialogManager.showMessage(this, DialogManager.ERROR_INSERT_USB);
		} catch (NetworkException e) {
			DialogManager.showMessage(this, DialogManager.ERROR_NETWORK);
		} catch (ServerException e) {
			DialogManager.showMessage(this, DialogManager.ERROR_SERVER, new String[] { e.getMessage() });
		} catch (TimeOutException e) {
			DialogManager.showMessage(this, DialogManager.ERROR_TIMEOUT);
		}
		
		return userKind;
	}

	public void actionPerformed(ActionEvent ae) {
		Object	obj = ae.getSource();
		
		if (obj == btnNext) {
			int				userKind = checkUSBKey(userInfo);
			CPPUserPanel	parent = (CPPUserPanel)getParent();
			
			if (parent != null) {
				switch (userKind) {
				case CPPUserInvoker.USER_MAINTENANCE:
					parent.goAdminUserPanel(userInfo);
					break;
				case CPPUserInvoker.USER_ADMIN:
				case CPPUserInvoker.USER_GENERAL:
					parent.goGeneralUserPanel(userInfo);
					break;
				case CPPUserInvoker.ERROR_NOT_REGISTERED_USER:
///					DialogManager.showMessage(this, DialogManager.ERROR_NOT_REGISTERED_USER_CPP);
					break;
				case CPPUserInvoker.ERROR_NOT_INSERT_USB:
///					DialogManager.showMessage(this, DialogManager.ERROR_INSERT_USB);
					break;
				default:
					break;
				}
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -