📄 loginsettingspanel.java
字号:
package openicq.gui;import java.awt.BorderLayout;import java.awt.Dimension;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.*;import javax.swing.border.Border;import openicq.Start;import openicq.data.Default;import openicq.data.Resource;import openicq.management.Oscar;import openicq.net.ChangePasswordRequest;import openicq.net.Flag;import org.javalib.gui.SpringToolkit;import org.javalib.gui.WholeNumberField;import org.javalib.gui.model.SettingsDisplayPanel;import org.javalib.io.CryptFile;/** * The <code>LoginSettingsPanel</code> class contains the panel with the login * settings. * @author Hansgeorg Schwibbe * @copyright 2004 */public class LoginSettingsPanel extends SettingsDisplayPanel{ private JPasswordField jPasswordFieldOldPw = new JPasswordField(); private JPasswordField jPasswordFieldNewPw1 = new JPasswordField(); private JPasswordField jPasswordFieldNewPw2 = new JPasswordField(); private JPanel jPanelLoginMode = new JPanel(); private JCheckBox jCheckBoxAutoSave = new JCheckBox(); private JCheckBox jCheckBoxAutoLogin = new JCheckBox(); private JPanel jPanelConnection = new JPanel(); private JLabel jLabelHost = new JLabel(); private JLabel jLabelPort = new JLabel(); private JTextField jTextFieldHost = new JTextField(); private WholeNumberField wholeNumberFieldPort = new WholeNumberField(); private JPanel jPanelChangePasswd = new JPanel(); private JLabel jLabelOldPw = new JLabel(); private JLabel jLabelNewPw1 = new JLabel(); private JLabel jLabelNewPw2 = new JLabel(); private JDialog parent; /** * Initializes a new instance of the class <code>LoginSettingsPanel</code>. * @param parent the parent dialog */ public LoginSettingsPanel(JDialog parent) { String text; Border compBorder, innerBorder, outerBorder; this.parent = parent; // Login mode panel jPanelLoginMode.setLayout(new SpringLayout()); text = ((String[]) SettingsDialog.localized.get("loginSettingsPanel"))[0]; jPanelLoginMode.setBorder(BorderFactory.createTitledBorder(text)); text = ((String[]) SettingsDialog.localized.get("login"))[4]; jCheckBoxAutoSave.setText(text); jCheckBoxAutoSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { action_selectCheckBoxAutoSave(); } }); text = ((String[]) SettingsDialog.localized.get("login"))[8]; jCheckBoxAutoLogin.setText(text); jCheckBoxAutoLogin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { action_selectCheckBoxAutoLogin(); } }); jPanelLoginMode.add(jCheckBoxAutoSave); jPanelLoginMode.add(jCheckBoxAutoLogin); SpringToolkit.makeCompactGrid(jPanelLoginMode, 2, 1, 5, 0, 5, 5); // Connection panel jPanelConnection.setLayout(new SpringLayout()); text = ((String[]) SettingsDialog.localized.get("login"))[5]; innerBorder = BorderFactory.createTitledBorder(text); outerBorder = BorderFactory.createEmptyBorder(0, 0, 0, 320); compBorder = BorderFactory.createCompoundBorder(innerBorder, outerBorder); jPanelConnection.setBorder(compBorder); jLabelHost.setText(((String[]) SettingsDialog.localized.get("login"))[6]); jLabelPort.setText(((String[]) SettingsDialog.localized.get("login"))[7]); jTextFieldHost.setMaximumSize(new Dimension(160, 25)); wholeNumberFieldPort.setMaximumSize(new Dimension(160, 25)); jPanelConnection.add(jLabelHost); jPanelConnection.add(jTextFieldHost); jPanelConnection.add(jLabelPort); jPanelConnection.add(wholeNumberFieldPort); JTextField buffer = new JTextField(); buffer.setVisible(false); jPanelConnection.add(buffer); SpringToolkit.makeCompactGrid(jPanelConnection, 5, 1, 5, 0, 5, 5); // Change password panel text = ((String[]) SettingsDialog.localized.get("loginSettingsPanel"))[1]; innerBorder = BorderFactory.createTitledBorder(text); outerBorder = BorderFactory.createEmptyBorder(0, 0, 0, 280); compBorder = BorderFactory.createCompoundBorder(innerBorder, outerBorder); jPanelChangePasswd.setBorder(compBorder); text = ((String[]) SettingsDialog.localized.get("loginSettingsPanel"))[2]; jLabelOldPw.setText(text); text = ((String[]) SettingsDialog.localized.get("loginSettingsPanel"))[3]; jLabelNewPw1.setText(text); text = ((String[]) SettingsDialog.localized.get("loginSettingsPanel"))[4]; jLabelNewPw2.setText(text); jPanelChangePasswd.setLayout(new SpringLayout()); jPanelChangePasswd.add(jLabelOldPw); jPanelChangePasswd.add(jPasswordFieldOldPw); jPanelChangePasswd.add(jLabelNewPw1); jPanelChangePasswd.add(jPasswordFieldNewPw1); jPanelChangePasswd.add(jLabelNewPw2); jPanelChangePasswd.add(jPasswordFieldNewPw2); SpringToolkit.makeCompactGrid(jPanelChangePasswd, 6, 1, 5, 0, 5, 5); // This innerBorder = BorderFactory.createLoweredBevelBorder(); outerBorder = BorderFactory.createEmptyBorder(10, 10, 10, 10); compBorder = BorderFactory.createCompoundBorder(innerBorder, outerBorder); this.setBorder(compBorder); this.setLayout(new BorderLayout()); this.add(jPanelLoginMode, BorderLayout.NORTH); this.add(jPanelConnection, BorderLayout.CENTER); this.add(jPanelChangePasswd, BorderLayout.SOUTH); } /** * Action 'Checkbox auto login klicked'. */ protected void action_selectCheckBoxAutoLogin() { if (jCheckBoxAutoLogin.isSelected()) { jCheckBoxAutoSave.setSelected(true); jCheckBoxAutoSave.setEnabled(false); } else { jCheckBoxAutoSave.setSelected(false); jCheckBoxAutoSave.setEnabled(true); } } /** * Action 'Checkbox auto save klicked'. */ protected void action_selectCheckBoxAutoSave() { if (jCheckBoxAutoSave.isSelected()) { jCheckBoxAutoLogin.setEnabled(false); } else { jCheckBoxAutoLogin.setEnabled(true); } } /** * (non-Javadoc) * @see org.javalib.gui.model.SettingsDisplayPanel#getContinueWithoutSavingMessage() */ public String getContinueWithoutSavingMessage() { return ((String[]) SettingsDialog.localized.get("warningMessages"))[0] + "\n" + ((String[]) SettingsDialog.localized.get("questionMessages"))[0]; } /** * (non-Javadoc) * @see org.javalib.gui.model.SettingsDisplayPanel#getContinueWithoutSavingTitle() */ public String getContinueWithoutSavingTitle() { return ((String[]) SettingsDialog.localized.get("messageTitles"))[2]; } /** * (non-Javadoc) * @see org.javalib.gui.model.SettingsDisplayPanel#getListIconPath() */ public String getListIconPath() { return Resource.ICON_SOURCE_SETTINGS[1]; } /** * (non-Javadoc) * @see org.javalib.gui.model.SettingsDisplayPanel#getListName() */ public String getListName() { return ((String[]) SettingsDialog.localized.get("settingsDialogList"))[1]; } /** * (non-Javadoc) * @see org.javalib.gui.model.SettingsDisplayPanel#getSaveButtonText() */ public String getSaveButtonText() { return ((String[]) SettingsDialog.localized.get("stdButtons"))[2] + " (" + ((String[]) SettingsDialog.localized.get("settingsDialogList"))[1] + ")"; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -