?? checkspkeypanel.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;
}
}
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -