⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addpop3account.java

📁 create the email in the server
💻 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 AddPOP3Account extends javax.swing.JPanel {
	private JLabel emailAddress;
	private JTextField emailAddressText;
	private JLabel displayName;
	private JTextField displayNameText;
	private JLabel username;
	private JLabel password;
	private JTextField smtpServerText;
	private JLabel smtpServer;
	private JTextField pop3ServerText;
	private JLabel pop3Server;
	private JPasswordField passwordText;
	private JTextField usernameText;
	private AccountOfClient accountOfClient;
	private JButton saveAndClose, cancelButton;
	private JSplitPane splitpane;
	private Vector<AccountOfClient> accounts;
	private String username_, password_ , displayName_ , pop3Server_ , smtpServer_, emailAddress_;
	private JList list;

	/**
	* 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 AddPOP3Account(JSplitPane splitpane, Vector<AccountOfClient> accounts, JList list)
	{
		super();
		this.list = list;
		this.splitpane = splitpane;
		this.accounts = accounts;
		initGUI();
		
	}
	
	private void initGUI() {
		try {
			this.setPreferredSize(new java.awt.Dimension(274, 258));
			splitpane.setDividerLocation(300);
			this.setLayout(null);
			{
				displayName = new JLabel();
				this.add(displayName);
				displayName.setText("Display name");
				displayName.setBounds(6, 7, 76, 16);
			}
			{
				displayNameText = new JTextField();
				this.add(displayNameText);
				displayName_ = displayNameText.getText();
				displayNameText.setBounds(121, 4, 134, 30);
			}
			{
				username = new JLabel();
				this.add(username);
				username.setText("Username");
				username.setBounds(5, 35, 66, 30);
			}
			{
				usernameText = new JTextField();
				this.add(usernameText);
				username_ = usernameText.getText();
				usernameText.setBounds(121, 32, 134, 30);
			}
			{
				password = new JLabel();
				this.add(password);
				password.setText("Password");
				password.setBounds(5, 63, 60, 30);
			}
			{
				passwordText = new JPasswordField();
				this.add(passwordText);
				password_ = new String(passwordText.getPassword());
				passwordText.setBounds(121, 60, 133, 30);
			}
			{
				emailAddress = new JLabel();
				this.add(emailAddress);
				emailAddress.setText("Email Address");
				emailAddress.setBounds(5, 91, 87, 30);
			}
			{
				emailAddressText = new JTextField();
				this.add(emailAddressText);
				emailAddress_ = emailAddressText.getText();
				emailAddressText.setBounds(121, 88, 132, 30);
			}
			{
				pop3Server = new JLabel();
				this.add(pop3Server);
				pop3Server.setText("POP3 Server");
				pop3Server.setBounds(4, 119, 89, 30);
			}
			{
				pop3ServerText = new JTextField();
				this.add(pop3ServerText);
				pop3Server_ = pop3ServerText.getText();
				pop3ServerText.setBounds(121, 116, 132, 30);
			}
			{
				smtpServer = new JLabel();
				this.add(smtpServer);
				smtpServer.setText("SMTP Server");
				smtpServer.setBounds(4, 147, 89, 30);
			}
			{
				smtpServerText = new JTextField();
				this.add(smtpServerText);
				smtpServer_ = smtpServerText.getText();
				smtpServerText.setBounds(121, 144, 132, 30);
			}
			{
				saveAndClose = new JButton(new SaveAction());
				this.add(saveAndClose);
				saveAndClose.setText("Save & Close");
				saveAndClose.setBounds(3, 175, 109, 26);
			}
			{
				cancelButton = new JButton(new CancelAction());
				this.add(cancelButton);
				cancelButton.setText("Cancel");
				cancelButton.setBounds(117, 172, 73, 26);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	class SaveAction extends AbstractAction {
		SaveAction() {
			super("Save record");
		}

		public void actionPerformed(ActionEvent arg0) 
		{
			smtpServer_ = smtpServerText.getText();
			pop3Server_ = pop3ServerText.getText();
			splitpane.setDividerLocation(300);
			displayName_ = displayNameText.getText();
			password_ = new String(passwordText.getPassword());
			username_ = usernameText.getText();
			emailAddress_ = emailAddressText.getText();
			accountOfClient = new AccountOfClient(username_ , 
					password_ , pop3Server_,smtpServer_,  
					displayName_, emailAddress_);
			accounts.addElement( accountOfClient);
			CleanPanel cleanpanel = new CleanPanel();
			splitpane.setDividerLocation(300);
			splitpane.setRightComponent(cleanpanel);
			list.setListData(accounts);
			
		}
	}
	
	class CancelAction extends AbstractAction {
		CancelAction() {
			super("cancel creation of POP3 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 + -