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

📄 groupsviewpanel.java

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

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Vector;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.ListCellRenderer;
import javax.swing.WindowConstants;
import javax.swing.JFrame;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLFrameHyperlinkEvent;
import za.co.halo.SecureCommunications.Email;
import za.co.halo.SecureCommunications.ServerGroup;
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
 * GroupsViewPanel Class
 * This class presents the GUI for viewing and editing groups
 */
public class GroupsViewPanel extends javax.swing.JPanel {

	private static final long serialVersionUID = 1L;
	private JList groupList;
	public JSplitPane splitpane2;
	private GroupsPanel groupsPanel;
	private int localindex;
	private Vector<ServerGroup> groups;
	private ServerManager 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 EmailPanel(null,null));
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}
	
   /**
	* GroupsViewPanel constructor
	* Use to:
	* initialize member variables
	* initialize the build of graphical components.
	* @param groups, splitpane_, groupsPanel: to initialize the member functions
	* @return void 
	*/
	public GroupsViewPanel(Vector<ServerGroup> groups, JSplitPane splitpane_ , GroupsPanel groupsPanel,ServerManager accounts) 
	{
		super();
		splitpane2 = splitpane_;
		this.groupsPanel = groupsPanel;
		this.groups = groups;
		this.accounts = accounts;
		initGUI();
	}
	
   /**
	* initGUI method
	* Use to:
	* initialize graphics
	* @param void
	* @return void 
	*/
	private void initGUI() {
		try {
			BorderLayout thisLayout = new BorderLayout();
			this.setLayout(thisLayout);
			setPreferredSize(new Dimension(200, 300));
			{
				{
					groupList = new JList(groups);
					splitpane2.setDividerLocation(250);
					groupList.setBackground(new Color(21,118,146));
					this.add(groupList, BorderLayout.CENTER);
					
					groupList.setCellRenderer(new GroupCellRenderer());
					groupList.setPreferredSize(new java.awt.Dimension(388, 181));
					groupList.setSize(200,300);
					MouseListener mouseListener = new MouseAdapter() {
					     public void mouseClicked(MouseEvent e/*, ComposeMail composeMail*/) {
					    	if (e.getClickCount() == 2) 
					         {
					            
					           					        
					         } 
					    	 if (e.getClickCount() == 1) 
					         {
					    		   groupsPanel.removeButton.setEnabled(true);
					    		   int index = groupList.locationToIndex(e.getPoint());
					    		   if (index != -1)
					    		   {
					    			   ServerGroup group = groups.get(index);
							           localindex = index;
							           SingleGroupViewPanel panel = new SingleGroupViewPanel(group, index,groups,splitpane2,accounts);
							           splitpane2.setRightComponent(panel);
							           splitpane2.setDividerLocation(250);
					    		   }
					         }
					     }
					 };
					 groupList.addMouseListener(mouseListener);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
    class Hyperactive implements HyperlinkListener {
    	 
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                JEditorPane pane = (JEditorPane) e.getSource();
                if (e instanceof HTMLFrameHyperlinkEvent) {
                    HTMLFrameHyperlinkEvent  evt = (HTMLFrameHyperlinkEvent)e;
                    HTMLDocument doc = (HTMLDocument)pane.getDocument();
                    doc.processHTMLFrameHyperlinkEvent(evt);
                } else {
                    try {
                        pane.setPage(e.getURL());
                    } catch (Throwable t) {
                        t.printStackTrace();
                    }
                }
            }
        }
    }

	
    /**
	* GroupCellRenderer class
	* customize the groups JList
	*/
    class GroupCellRenderer implements ListCellRenderer
	{
    	/**
    	* getListCellRendererComponent method
    	* Use to:
    	* add customized group list details
    	* @param Jlist list, Object object, int index, boolean isSelected, boolean arg4
    	* @return Component : the panel to add on the groups list 
    	*/
    	public Component getListCellRendererComponent(JList list, Object object, int index, boolean isSelected, boolean arg4) 
		{
			JPanel panel = new JPanel();
			panel.setSize(150,20);
			if (object instanceof ServerGroup)
			{
				ServerGroup e = (ServerGroup)object;
				panel.setLayout(new BorderLayout());
				panel.add(new SingleGroupClass(e, isSelected ));
			}
			else 
				panel.add(new JLabel("Could not load information"));
			return panel;
		}
	}
	
	/*class ViewEmailEditorPane extends JEditorPane
	{
		public ViewEmailEditorPane()
		{
			
			HTMLEditorKit kit = new HTMLEditorKit();
            StyleSheet style = new StyleSheet();
            try {
           	 File f = new File("emailstylesheet.css");
           	 
				style.importStyleSheet(f.toURL());
			      } 
            catch (MalformedURLException e1) 
            {
				e1.printStackTrace();
			 }
            kit.setStyleSheet(style);
            setEditorKit(kit);

		}*/
		
		public void setText(Email e)
		{
           
       }
	
	//}
	
	public int getIndex()
	{
		return localindex;
	}

	public JList getList()
	{
		return groupList;
	}
}
		
		

⌨️ 快捷键说明

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