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

📄 groupspanel.java

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

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.AbstractAction;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import javax.swing.JFrame;
import javax.swing.JSplitPane;
import za.co.halo.SecureCommunications.ServerGroup;
import za.co.halo.SecureCommunications.ServerGroupManager;
import za.co.halo.SecureCommunications.ServerManager;



/**
* 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.
* *************************************
*/

/**
 * @author
 * GroupsPanel class
 * Presents the GUI for handling groups 
 * The actions of adding or removing a group are available 
 * The GroupsViewPanel class are used by the GroupsPanel which 
 * represent a way of managing the groups
 */
public class GroupsPanel extends javax.swing.JPanel {
	public JSplitPane splitpane;
	public JEditorPane leftEditorpane;
	public JPanel leftButtonPanel;
	public JButton removeButton;
	private JButton AddButton;
	public JPanel rightButtonPanel;
	public JPanel rightPanel;
	private JList list;
	public GroupsViewPanel panel;
	int index = 0;
	public Vector<ServerGroup> vectorOfGroup;
	private ServerManager accounts;
	
   /**
	* main method
	* Use to:
	* display this JPanel inside a new JFrame.
	*/
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		//ServerGroupManager groups = groups.load();
		//groups = groups.load();
		//frame.getContentPane().add(new GroupsPanel(groups));
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}
	
   /**
	* GroupsPanel constructor 
	* Use to:
	* initialize member variables
	* initialize the build of graphical components.
	* @param groups, accounts: to initialize the member functions
	* @return void 
	*/
	public GroupsPanel(ServerGroupManager groups, ServerManager accounts) 
	{
		super();
		this.accounts = accounts;
		System.out.println("Opened Server Groups Panel");
		vectorOfGroup = groups.getGroups();
		initGUI();
	}
	
   /**
	* initGUI method
	* Use to:
	* initialize graphics
	* @param void
	* @return void 
	*/
	private void initGUI() {
		try {
			setPreferredSize(new Dimension(600,500));
			this.setLayout(null);
			{
				JPanel imagePanel = new ImagePanel("images/groups.png","accounts");
				imagePanel.setLayout(null);
				imagePanel.setBounds(0,0,625,83);
				this.add(imagePanel);
				
				splitpane = new JSplitPane();
				this.add(splitpane);
				splitpane.setPreferredSize(new java.awt.Dimension(600, 333));
				splitpane.setBounds(7, 100, 600, 333);
				splitpane.setDividerLocation(300);
				{
					panel = new GroupsViewPanel(vectorOfGroup,splitpane, this,accounts);
					list = panel.getList();
					panel.setSize(200, 300);
					panel.setMinimumSize(new Dimension(300, 300));
					splitpane.add(panel, JSplitPane.LEFT);
					splitpane.setDividerLocation(250);
				}
				{
					rightPanel = new JPanel();
					splitpane.add(rightPanel, JSplitPane.RIGHT);
					rightPanel.setPreferredSize(new java.awt.Dimension(154, 331));
					splitpane.setDividerLocation(250);
				}
			}
			{
				leftButtonPanel = new JPanel();
				this.add(leftButtonPanel);
				leftButtonPanel.setPreferredSize(new java.awt.Dimension(183, 52));
				leftButtonPanel.setLayout(null);
				leftButtonPanel.setBounds(13, 443, 305, 52);
				{
					AddButton = new JButton(new AddAction());
					leftButtonPanel.add(AddButton);
					AddButton.setText("Add Group");
					AddButton.setPreferredSize(new java.awt.Dimension(102, 26));
					AddButton.setBounds(3, 1, 143, 26);
				}
				{
					removeButton = new JButton(new RemoveAction());
					leftButtonPanel.add(removeButton );
					removeButton.setText("Remove Group");
					removeButton.setEnabled(false);
					removeButton.setPreferredSize(new java.awt.Dimension(96, 26));
					removeButton.setBounds(152, 1, 143, 26);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
   /**
	* AddAction class
	* Provides the functionality of handling add actions.
	*/
	class AddAction extends AbstractAction {
		private AddGroupPanel addGroupPanel;

		AddAction() 
		{
			super("Add account");
		}

	   /**
		* actionPeformed method
		* Use to:
		* Handle add actions
		* @param ActionEvent: the type of action
		* @return void 
		*/
		public void actionPerformed(ActionEvent arg0) 
		{
			addGroupPanel = new AddGroupPanel(splitpane, vectorOfGroup, accounts, list);
			splitpane.add(addGroupPanel, JSplitPane.RIGHT);
		}

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

	   /**
		* actionPeformed method
		* Use to:
		* Handle remove actions
		* @param ActionEvent: the type of action
		* @return void 
		*/
		public void actionPerformed(ActionEvent arg0) 
		{
			int indexToRemove = panel.getIndex();
			vectorOfGroup.remove(indexToRemove);
			splitpane.setRightComponent(new CleanPanel());
			panel.repaint();
			
		}
	}
}

⌨️ 快捷键说明

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