?? checkspkeypanel.java
字號(hào):
package jp.co.ntl.swing.ext.spstool;
import java.awt.Font;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.BorderLayout;
import java.awt.Rectangle;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.text.MessageFormat;
import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.JLabel;
import jp.co.ntl.Net;
import jp.co.ntl.NetworkException;
import jp.co.ntl.ServerException;
import jp.co.ntl.TimeOutException;
import jp.co.ntl.Util;
import jp.co.ntl.preference.PreferenceInfo;
import jp.co.ntl.swing.BasePanel;
import jp.co.ntl.swing.ext.MultiLineLabel;
public class CheckSPKeyPanel extends BasePanel implements ComponentListener {
/**
*
*/
private static final long serialVersionUID = 1L;
protected MultiLineLabel lblMultiMsg;
protected JLabel lblMsg;
public CheckSPKeyPanel(JFrame parent, Net net) {
this(parent, net, BasePanel.ADMIN_PANEL);
}
public CheckSPKeyPanel(JApplet app, Net net) {
this(app, net, BasePanel.ADMIN_PANEL);
}
public CheckSPKeyPanel(JFrame parent, Net net, int kind) {
super(parent, net, kind);
}
public CheckSPKeyPanel(JApplet app, Net net, int kind) {
super(app, net, kind);
}
protected void buildComponents() {
String msg = "";
if (kind != BasePanel.ADMIN_PANEL) {
switch (Util.getPreferenceInfo().getAuthType()) {
case PreferenceInfo.AUTH_USB:
msg = Resource.getString(Resource.CHECK_SP_KEY_PANEL_MESSAGE);
break;
case PreferenceInfo.AUTH_NET_FELICA:
case PreferenceInfo.AUTH_FELICA:
msg = Resource.getString(Resource.CHECK_SP_KEY_PANEL_PUT_MESSAGE);
break;
}
lblMsg = new JLabel(msg, JLabel.CENTER);
lblMsg.setFont(new Font(null, Font.BOLD, 24));
add(lblMsg, BorderLayout.CENTER);
} else {
switch (Util.getPreferenceInfo().getAuthType()) {
case PreferenceInfo.AUTH_USB:
msg = Resource.getString(Resource.CHECK_SP_KEY_PANEL_ADMIN_MESSAGE);
break;
case PreferenceInfo.AUTH_NET_FELICA:
case PreferenceInfo.AUTH_FELICA:
msg = Resource.getString(Resource.CHECK_SP_KEY_PANEL_PUT_ADMIN_MESSAGE);
break;
}
setLayout(null);
Font pFont = new Font(null, Font.BOLD, 24);
lblMultiMsg = new MultiLineLabel(
msg,
pFont,
getForeground(),
getBackground(),
MultiLineLabel.CENTER);
Rectangle rc = calcControlLocation();
lblMultiMsg.setBounds(rc.x, rc.y, rc.width, rc.height);
add(lblMultiMsg);
}
}
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;
}
public void setMessage(String message) {
setMessage(message, null);
}
public void setMessage(String message, String[] params) {
String msgDisp = "";
if (params == null) {
msgDisp = message;
} else {
msgDisp = MessageFormat.format(message, (Object[])params);
}
if (kind != BasePanel.ADMIN_PANEL) {
lblMsg.setText(msgDisp);
} else {
lblMultiMsg.setText(msgDisp);
}
}
protected Rectangle calcControlLocation() {
Dimension dim = parent.getSize();
Font pFont = new Font(null, Font.BOLD, 24);
FontMetrics fm = getFontMetrics(pFont);
Rectangle rc = new Rectangle();
rc.x = 0;
rc.y = dim.height / 2 - (fm.getHeight() + 10) * 2;
rc.width = dim.width;
rc.height = (fm.getHeight() + 10) * 2;
return rc;
}
protected void recalcControlBounds() {
Rectangle rc = calcControlLocation();
lblMultiMsg.setBounds(rc.x, rc.y, rc.width, rc.height);
lblMultiMsg.repaint();
}
public void componentHidden(ComponentEvent ce) {
}
public void componentMoved(ComponentEvent ce) {
}
public void componentResized(ComponentEvent ce) {
recalcControlBounds();
}
public void componentShown(ComponentEvent ce) {
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -