📄 addrmiaccount.java
字号:
package za.co.halo.SecureCommunications.gui.client2;
import java.awt.event.ActionEvent;
import java.util.Vector;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JList;
import javax.swing.JSplitPane;
import javax.swing.WindowConstants;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import za.co.halo.SecureCommunications.AccountOfClient;
/**
* This code was generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* *************************************
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED
* for this machine, so Jigloo or this code cannot be used legally
* for any corporate or commercial purpose.
* *************************************
*/
public class AddRMIAccount extends javax.swing.JPanel {
private JLabel displayName;
private JTextField displayNameText;
private JLabel emailaddress;
private JTextField emailaddressText;
private JLabel username;
private JLabel password;
private JTextField rmiServerText;
private JLabel rmiServer;
private JPasswordField passwordField1;
private JTextField usernameText;
private JButton saveAndClose, cancelButton;
private JSplitPane splitpane;
private JList list;
private Vector<AccountOfClient> accounts;
private String displayName_ , password_ , username_ , rmiServer_;
private String emailaddress_;
/**
* Auto-generated main method to display this
* JPanel inside a new JFrame.
*/
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
public AddRMIAccount(JSplitPane splitpane, Vector<AccountOfClient> accounts, JList list) {
super();
this.list = list;
this.accounts = accounts;
initGUI();
this.splitpane = splitpane;
}
private void initGUI() {
try {
this.setPreferredSize(new java.awt.Dimension(281, 300));
this.setLayout(null);
{
displayName = new JLabel();
this.add(displayName);
displayName.setText("Display name");
displayName.setBounds(3, 5, 76, 16);
}
{
displayNameText = new JTextField();
this.add(displayNameText);
displayName_ = displayNameText.getText();
displayNameText.setBounds(117, 5, 136, 30);
}
{
username = new JLabel();
this.add(username);
username.setText("User name");
username.setBounds(4, 43, 77, 30);
}
{
usernameText = new JTextField();
this.add(usernameText);
username_ = usernameText.getText();
usernameText.setBounds(117, 43, 136, 30);
}
{
password = new JLabel();
this.add(password);
password.setText("Password");
password.setBounds(3, 81, 60, 30);
}
{
passwordField1 = new JPasswordField();
this.add(passwordField1);
password_ = new String(passwordField1.getPassword());
passwordField1.setBounds(117, 81, 136, 30);
}
{
emailaddress = new JLabel();
this.add(emailaddress);
emailaddress.setText("Email address");
emailaddress.setBounds(3, 119, 60, 30);
}
{
emailaddressText = new JTextField();
this.add(emailaddressText);
emailaddress_ = emailaddressText.getText();
emailaddressText.setBounds(117, 119, 136, 30);
}
{
rmiServer = new JLabel();
this.add(rmiServer);
rmiServer.setText("RMI Server");
rmiServer.setBounds(3, 157, 82, 30);
}
{
rmiServerText = new JTextField();
this.add(rmiServerText);
rmiServer_ = rmiServerText.getText();
rmiServerText.setBounds(118, 157, 137, 30);
}
{
saveAndClose = new JButton(new SaveAction());
//saveAndClose.setEnabled(false);
this.add(saveAndClose);
saveAndClose.setText("Save & Close");
saveAndClose.setBounds(3, 195, 109, 26);
}
{
cancelButton = new JButton(new CancelAction());
this.add(cancelButton);
cancelButton.setText("Cancel");
cancelButton.setBounds(117, 195, 73, 26);
}
} catch (Exception e) {
e.printStackTrace();
}
}
class SaveAction extends AbstractAction {
SaveAction() {
super("Save record");
}
public void actionPerformed(ActionEvent arg0)
{
rmiServer_ = rmiServerText.getText();
password_ = new String(passwordField1.getPassword());
displayName_ = displayNameText.getText();
username_ = usernameText.getText();
emailaddress_ = emailaddressText.getText();
AccountOfClient accountOfClient = new AccountOfClient(username_ , password_ , rmiServer_, displayName_, emailaddress_);
CleanPanel cleanpanel = new CleanPanel();
splitpane.setDividerLocation(300);
splitpane.setRightComponent(cleanpanel);
accounts.addElement(accountOfClient);
list.setListData(accounts);
}
}
class CancelAction extends AbstractAction {
CancelAction() {
super("cancel creation of RMI account");
}
public void actionPerformed(ActionEvent arg0)
{
CleanPanel cleanpanel = new CleanPanel();
splitpane.setDividerLocation(300);
splitpane.setRightComponent(cleanpanel);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -