📄 changeuserinfodialog.java
字号:
/*
* ChangeUserInfoDialog.java
*
* Copyright (C) 2000 Jason M. Hanley
* Released under the GNU General Public License (GPL)
* See license.txt for additional information.
*
* Created on September 11, 2000, 12:15 AM
*/
package fate.client;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
import fate.messages.*;
import fate.network.*;
import fate.ui.*;
import fate.util.*;
/**
* UI for modifying user info such as username, password, etc.
*
* @author preylude@s3m.com
* @version 0.1.0
*/
public class ChangeUserInfoDialog extends JDialog implements ActionListener {
JTextField editNewUsername, editEmail;
JPasswordField editNewPassword, editNewPassword2;
ConsoleFrame parent;
/** Creates new ChangeUserInfoDialog */
public ChangeUserInfoDialog( ConsoleFrame parent ) {
super( parent, "Change User Info", true );
this.parent = parent;
Box box = new Box( BoxLayout.Y_AXIS );
editNewUsername = SwingUtil.addTextField( box, "New Username:", 32 );
editNewPassword = SwingUtil.addPasswordField( box, "New Password:", 32 );
editNewPassword2 = SwingUtil.addPasswordField( box, "Verify Password:", 32 );
JPanel panelButtons = new JPanel();
SwingUtil.addButton( panelButtons, "Ok", 'o', "ok", this );
SwingUtil.addButton( panelButtons, "Cancel", 'c', "cancel", this );
box.add( panelButtons );
getContentPane().add( box );
}
public void actionPerformed( ActionEvent e ) {
String strAction = e.getActionCommand();
Debug.trace( "client.MainFrame: ActionCommand: " + strAction );
if ( strAction.equals( "ok" ) ) {
if( editNewPassword.getText().equals( editNewPassword2.getText() ) ) {
ChangeLoginMessage msgToSend = new ChangeLoginMessage( editNewUsername.getText(),
editNewPassword.getText(), true );
// Send the change username/password message
parent.connection.sendMessage( msgToSend );
hide();
} else {
JOptionPane.showMessageDialog( this, "Error: Passwords don't match.\nPlease try again.",
"Error", JOptionPane.ERROR_MESSAGE);
}
}
if ( strAction.equals( "cancel" ) ) {
hide();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -