?? messagedialog.java
字號:
package jp.co.ntl.swing.ext;
import java.awt.Component;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import jp.co.ntl.Util;
public class MessageDialog extends JOptionPane implements MessageConstants {
/**
*
*/
private static final long serialVersionUID = 1L;
private JDialog dialog = null;
public MessageDialog(String message, int messageType) {
super(message, messageType);
}
public MessageDialog(String message, int messageType, int optionType) {
super(message, messageType, optionType);
}
public void showDialog(Component parent) {
Resource.load(Util.getCurrentLocale());
dialog = createDialog(getFrameForComponent(parent), Resource.getString(Resource.TITLE_MESSAGE));
dialog.setVisible(true);
}
public void hideDialog() {
if (dialog != null) {
dialog.setVisible(false);
dialog = null;
}
}
public int getSelection() {
Object selectedValue = getValue();
if (selectedValue != null && selectedValue instanceof Integer) {
return ((Integer)selectedValue).intValue();
}
return CLOSED_OPTION;
}
/* public static void showMessage(Component parent, int msgID) {
showMessage(parent, msgID, null);
}
public static void showMessage(Component parent, int msgID, String[] param) {
int type = WARNING_MESSAGE;
if (msgID >= DOWNLOAD_SUCCESS) {
type = JOptionPane.INFORMATION_MESSAGE;
}
MessageDialog dialog = new MessageDialog(MsgUtil.getMessage(msgID, param), type);
dialog.showDialog(parent);
}
public static int showConfirmMessage(Component parent, int msgID, int optionType) {
return showConfirmMessage(parent, msgID, optionType, null);
}
public static int showConfirmMessage(Component parent, int msgID, int optionType, String[] param) {
int type = WARNING_MESSAGE;
if (msgID >= DOWNLOAD_SUCCESS) {
type = INFORMATION_MESSAGE;
}
MessageDialog dialog = new MessageDialog(MsgUtil.getMessage(msgID, param), type, optionType);
dialog.showDialog(parent);
return dialog.getSelection();
}*/
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -