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

📄 singleviewaccountpanel.java

📁 create the email in the server
💻 JAVA
字号:
package za.co.halo.SecureCommunications.gui.server;

import java.awt.event.ActionEvent;
import java.util.Vector;
import javax.swing.AbstractAction;
import javax.swing.JButton;
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.ServerAccount;
import za.co.halo.SecureCommunications.ServerAdmin;
/**
 * @author
 * SingleViewAccountPanel class
 * This panel performs the functionality of viewing account detail
 * and also presents the user with the option to update account detial
 */

/**
* 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 SingleViewAccountPanel extends javax.swing.JPanel {
	private JLabel usernameLabel;
	private JLabel password;
	private JTextField username;
	private JPasswordField passwordText;
	private ServerAccount account;
	private JButton saveAndClose, cancelButton;
	private int index;
	private JSplitPane splitpane;
	private SingleViewAccountPanel thispanel;
	private Vector<ServerAccount> accounts;
	
   /**
	* main method
	* Use 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);
	}
	
   /**
	* SingleViewAccountPanel constructor
	* Use to:
	* initialize member variables
	* initialize the build of graphical components.
	* @param ServerAccount(account_), int(index), Vector<ServerAccount>(accounts), JSplitPane(splitpane): to initialize the member functions
	* @return void 
	*/
	public SingleViewAccountPanel(ServerAccount account_, int index, Vector<ServerAccount> accounts , JSplitPane splitpane ) {
		super();
		thispanel = this;
		account = account_;
		initGUI();
		//this.client = client;
		this.accounts = accounts;
		this.index = index;
		this.splitpane = splitpane;
	}
	
   /**
	* initGUI method
	* Use to:
	* build the graphics
	* @param void
	* @return void 
	*/
	private void initGUI() {
		try {
			this.setLayout(null);
			this.setPreferredSize(new java.awt.Dimension(298, 298));
			{
				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);
			}
			{
				saveAndClose = new JButton(new SaveAction());
				//saveAndClose.setEnabled(false);
				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();
		}
	}
	
   /**
	* SaveAction class
	* Provides the functionality of handling save actions.
	*/
	class SaveAction extends AbstractAction {
		SaveAction() {
			super("Save record");
		}

	   /**
		* actionPeformed method
		* Use to:
		* Handle save actions
		* @param ActionEvent: the type of action
		* @return void 
		*/
		public void actionPerformed(ActionEvent arg0) 
		{
			String username_ = username.getText();
			String password = new String(passwordText.getPassword());
			ServerAccount account = new ServerAccount(username_ , password, ServerAdmin.DEFAULT_MAX_MAILBOX_SIZE);
			accounts.setElementAt(account , index);
			//accounts.addElement(accountOfClient);
			//splitpane.doLayout();
			
			//System.out.println("save pop3 "+ accountOfClient.getDisplayName());
			CleanPanel cleanpanel = new CleanPanel();
			splitpane.setRightComponent(cleanpanel);
		}

	}
	
   /**
	* CancelAction class
	* Provides the functionality of handling cancel actions.
	*/
	class CancelAction extends AbstractAction {
		CancelAction() {
			super("cancel creation of RMI account");
		}

	   /**
		* actionPeformed method
		* Use to:
		* Handle cancel actions
		* @param ActionEvent: the type of action
		* @return void 
		*/
		public void actionPerformed(ActionEvent arg0) 
		{
			CleanPanel cleanpanel = new CleanPanel();
			splitpane.setRightComponent(cleanpanel);
		}
	}
}

⌨️ 快捷键说明

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