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

📄 singelpop3viewpanel.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.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JSplitPane;
import javax.swing.WindowConstants;
import javax.swing.JFrame;
import javax.swing.JLabel;
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 SingelPOP3ViewPanel extends javax.swing.JPanel {
	private JLabel usernameLabel;
	private JLabel password;
	private JTextField displayTextfield;
	private JLabel displayNameLabel;
	private JTextField smtpTextField;
	private JLabel smtpServerLabel;
	private JTextField pop3server;
	private JLabel pop3Server;
	private JTextField username;
	private JPasswordField passwordText;
	private AccountOfClient account;
	private JButton saveAndClose, cancelButton;
	private AccountOfClient accountOfClient;
	//private Client client;
	private int index;
	private JSplitPane splitpane;
	private SingelPOP3ViewPanel thispanel;
	private JPanel leftpanel;
	private Vector<AccountOfClient> accounts;
	private JTextField emailText;
	private JLabel emailLabel;
	/**
	* Auto-generated main method to display this 
	* JPanel inside a new JFrame.
	*/
	public static void main(String[] args) {
		JFrame frame = new JFrame();
	//	frame.getContentPane().add(new SingelPOP3ViewPanel());
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}
	
	public SingelPOP3ViewPanel(AccountOfClient account_, int index, Vector<AccountOfClient> accounts , JSplitPane splitpane ) {
		super();
		thispanel = this;
		account = account_;
		initGUI();
		//this.client = client;
		this.accounts = accounts;
		this.index = index;
		this.splitpane = splitpane;
	}
	
	private void initGUI() {
		try {
			this.setLayout(null);
			this.setPreferredSize(new java.awt.Dimension(298, 298));
			{
				displayNameLabel = new JLabel();
				this.add(displayNameLabel);
				displayNameLabel.setText("Display name");
				displayNameLabel.setBounds(7, 3, 83, 30);
			}
			{
				displayTextfield = new JTextField();
				this.add(displayTextfield);
				displayTextfield.setText(account.getDisplayName());
				displayTextfield.setBounds(104, 3, 173, 30);
			}
			{
				usernameLabel = new JLabel();
				/*BoxLayout usernameLabelLayout = new BoxLayout(
				usernameLabel,
				javax.swing.BoxLayout.X_AXIS);
				usernameLabel.setLayout(usernameLabelLayout);*/
				this.add(usernameLabel);
				usernameLabel.setText("Username");
				usernameLabel.setBounds(6, 40, 59, 16);
			}
			{
				username = new JTextField();
				this.add(username);
				username.setText(account.getUsername());
				username.setBounds(105, 40, 134, 30);
			}
			{
				password = new JLabel();
				this.add(password);
				password.setBounds(8, 78, 58, 16);
				password.setText("Password");
				password.setBounds(7, 78, 58, 16);
			}
			{
				passwordText = new JPasswordField();
				this.add(passwordText);
				passwordText.setText(account.getPassword());
				passwordText.setBounds(105, 78, 133, 30);
			}
			{
				emailLabel = new JLabel();
				this.add(emailLabel);
				emailLabel.setText("Email address");
				emailLabel.setBounds(7, 116, 86, 30);
			}
			{
				emailText = new JTextField();
				this.add(emailText);
				emailText.setText(account.getEmailAddress());
				emailText.setBounds(105, 116, 177, 30);
			}
			{
				pop3Server = new JLabel();
				this.add(pop3Server);
				pop3Server.setText("POP3 Server");
				pop3Server.setBounds(7, 154, 86, 30);
			}
			{
				pop3server = new JTextField();
				this.add(pop3server);
				pop3server.setText(account.getPop3Server());
				pop3server.setBounds(105, 154, 177, 30);
			}
			{
				smtpServerLabel = new JLabel();
				this.add(smtpServerLabel);
				smtpServerLabel.setText("SMTP Server");
				smtpServerLabel.setBounds(8, 192, 81, 30);
			}
			{
				smtpTextField = new JTextField();
				this.add(smtpTextField);
				smtpTextField.setText(account.getSmtpServer());
				smtpTextField.setBounds(105, 192, 177, 30);
			}
			{
				saveAndClose = new JButton(new SaveAction());
				this.add(saveAndClose);
				saveAndClose.setText("Save & Close");
				saveAndClose.setBounds(5, 230, 109, 26);
			}
			{
				cancelButton = new JButton(new CancelAction());
				this.add(cancelButton);
				cancelButton.setText("Cancel");
				//cancelButton.setEnabled(false);
				cancelButton.setBounds(119, 230, 73, 26);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	class SaveAction extends AbstractAction {
		SaveAction() {
			super("Save record");
		}

		public void actionPerformed(ActionEvent arg0) 
		{
			String displayName = displayTextfield.getText();
			String username_ = username.getText();
			String password = new String(passwordText.getPassword());
			String pop3Server = pop3server.getText();
			String smtpServer_ = smtpTextField.getText();
			String email = emailText.getText();
			accountOfClient = new AccountOfClient(username_ , password , pop3Server, smtpServer_,  displayName, email);
			accounts.setElementAt(accountOfClient , index);
			//accounts.addElement(accountOfClient);
			//splitpane.doLayout();
			
			//System.out.println("save pop3 "+ accountOfClient.getDisplayName());
			CleanPanel cleanpanel = new CleanPanel();
			splitpane.setRightComponent(cleanpanel);
		}

	}
	class CancelAction extends AbstractAction {
		CancelAction() {
			super("cancel creation of RMI account");
		}

		public void actionPerformed(ActionEvent arg0) 
		{
			CleanPanel cleanpanel = new CleanPanel();
			splitpane.setRightComponent(cleanpanel);
			
		}

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -