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

📄 .#server.java.1.22

📁 create the email in the server
💻 22
📖 第 1 页 / 共 2 页
字号:
		        accountButton.setBounds(25,60,200,30);
		        accountButton.setActionCommand("accounts");
		        accountButton.addActionListener(this);
		        accountButton.addMouseListener(this);
		        leftPanel.add(accountButton);
		        
		        groupButton = new JButton("Manage Groups");
		        groupButton.setBounds(25,95,200,30);
		        groupButton.setActionCommand("groups");
		        groupButton.addActionListener(this);
		        groupButton.addMouseListener(this);
		        leftPanel.add(groupButton);
		        
		        domainButton = new JButton("Change Domain Settings");
		        domainButton.setBounds(25,130,200,30);
		        domainButton.setActionCommand("domain");
		        domainButton.addActionListener(this);
		        domainButton.addMouseListener(this);
		        leftPanel.add(domainButton);
		        
		        downloadButton = new JButton("Change Download Policies");
		        downloadButton.setBounds(25,165,200,30);
		        downloadButton.setActionCommand("download");
		        downloadButton.addActionListener(this);
		        downloadButton.addMouseListener(this);
		       // downloadButton.setEnabled(false);
		        leftPanel.add(downloadButton);
		        
		        optionsButton = new JButton("Options");
		        optionsButton.setBounds(25,200,200,30);
		        optionsButton.setActionCommand("options");
		        optionsButton.addActionListener(this);
		        //webmailButton.addMouseListener(this);
		        optionsButton.setEnabled(false);
		        leftPanel.add(optionsButton);
		        
		        logButton = new JButton("View Log File");
		        logButton.setBounds(25,235,200,30);
		        logButton.setActionCommand("log");
		        logButton.addActionListener(this);
		        logButton.addMouseListener(this);
		        leftPanel.add(logButton);
		        
		       languageFilterButton = new JButton("Open Language Filter");
		       languageFilterButton.setBounds(25,270,200,30);
		       languageFilterButton.setActionCommand("languageFilter");
		       languageFilterButton.addActionListener(this);
		       languageFilterButton.addMouseListener(this);
		       leftPanel.add(languageFilterButton);
		        
		        infoPanel = new JPanel();
		        infoPanel.setBounds(20, 358, 205, 97);
		        infoPanel.setLayout(null);
		        infoPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(whiteLine,"Button Description",TitledBorder.LEADING,TitledBorder.TOP,customFont2,Color.white),BorderFactory.createEmptyBorder(5,5,5,5)));
		        infoPanel.setBackground(new Color(15,65,108));
		        leftPanel.add(infoPanel);

		        infoLabel = new JLabel();
		        infoLabel.setBounds(9, 16, 185, 70);
		        infoLabel.setText("<html><font Color=white>Move mouse over buttons for a <br> discription of their functionality</font></html>");
		        infoPanel.add(infoLabel);
		        
		        iCatImage = createImageIcon("images/welcome.jpg","iCat");
		        imageLabel = new JLabel(iCatImage);
		        imageLabel.setBounds(20,465,205,150);
		        leftPanel.add(imageLabel);
		        
		        tabbedPane = new JTabbedPane();
		        tabbedPane.setBounds(10, 20, 640, 584);
		        rightPanel.add(tabbedPane);
		        
		        serversTabPanel = new JPanel();
		        {
		        	serverPanel = new ServerPanel2();
		        	serversTabPanel.add(serverPanel);
		        }
		        tabbedPane.addTab("Servers",null,serversTabPanel,null);
		        
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	protected void processWindowEvent(WindowEvent e)
	{
		super.processWindowEvent(e);
		if (e.getID() == WindowEvent.WINDOW_CLOSED)
			exitAndSave();
	}
	
   /**
	* exitAndSave method
	* Use to:
	* handle save actions
	* @param void
	* @return void
	*/
	private void exitAndSave()
	{
		System.out.println("Exit and Save");
		accounts.save();
		groups.save();
		saveServerSettings();
		System.exit(0);
	}
	
   /**
	* createImageIcon method
	* Use to:
	* initializes a image by assigning a URL and description
	* @param path(String): indicate the URL of the image, description(String): provide the image with a discription
	* @return ImageIcon: the newly created image object 
	*/
    protected static ImageIcon createImageIcon(String path, String description)
    {
        java.net.URL imgURL = Server.class.getResource(path);
        if (imgURL != null)
        {
            return new ImageIcon(imgURL, description);
        }
        else
        {
            System.err.println("Couldn't find file: " + path);
            return null;
        }
    }
    
    /**
    * enableDiscription method
    * Use to:
	* enable the display of information for a particilar button
	* @param but(JButton): the button to which this action must be applied
	* @return void 
	*/
    protected void enableDiscription(JButton but)
    {
    	but.addMouseListener(this);
    }
    
   /**
	* actionPerformed method
	* Use to:
	* handle action events obtained by the actionListener
	* @param ActionEvent(e): determine the type of action
	* @return void 
	*/
    public void actionPerformed(ActionEvent e)
    {
    	if(e.getActionCommand().equals("accounts"))
    	{
    		accountTabPanel = new JPanel();
    		accountTabPanel.setLayout(null);
    		tabbedPane.addTab("Accounts",null,accountTabPanel,null);
    		tabbedPane.setSelectedComponent(accountTabPanel);
    		
    		serverAccountsPanel = new ServerAccountsPanel(accounts);
    		serverAccountsPanel.setBounds(5,5,800,490);
    		accountTabPanel.add(serverAccountsPanel);
    		
    		accountButton.setEnabled(false);
    		accountButton.removeMouseListener(this);
    		
    		closeButton = new JButton("Close");
    		closeButton.setBounds(560,525,70,26);
            accountTabPanel.add(closeButton);
            
            closeButton.addActionListener(new ActionListener()
            {
                public void actionPerformed(ActionEvent E)
                {
                    tabbedPane.remove(accountTabPanel);
                    accountButton.setEnabled(true);
                    enableDiscription(accountButton);
                }
            });
    	}
    	
    	if(e.getActionCommand().equals("groups"))
    	{
    		groupsTabPanel = new JPanel();
    		groupsTabPanel.setLayout(null);
    		tabbedPane.addTab("Groups",null,groupsTabPanel,null);
    		tabbedPane.setSelectedComponent(groupsTabPanel);
    		
    		groupsPanel = new GroupsPanel(groups, accounts);
    		groupsPanel.setBounds(5,5,800,490);
    		groupsTabPanel.add(groupsPanel);
    		
    		groupButton.setEnabled(false);
    		groupButton.removeMouseListener(this);
    		
    		closeButton = new JButton("Close");
    		closeButton.setBounds(560,525,70,26);
            groupsTabPanel.add(closeButton);
            
            closeButton.addActionListener(new ActionListener()
            {
                public void actionPerformed(ActionEvent E)
                {
                    tabbedPane.remove(groupsTabPanel);
                    groupButton.setEnabled(true);
                    enableDiscription(groupButton);
                }
            });
    	}
    	
    	if(e.getActionCommand().equals("domain"))
    	{
    		domainTabPanel = new JPanel();
    		domainTabPanel.setLayout(null);
    		tabbedPane.addTab("Domain",null,domainTabPanel,null);
    		tabbedPane.setSelectedComponent(domainTabPanel);
    		
    		domainButton.setEnabled(false);
    		domainButton.removeMouseListener(this);
    		
    		domainPanel = new DomainPanel(serverSettings);
    		domainPanel.setBounds(5,5,800,490);
    		domainTabPanel.add(domainPanel);
    		
    		closeButton = new JButton("Close");
    		closeButton.setBounds(560,525,70,26);
            domainTabPanel.add(closeButton);
            
            closeButton.addActionListener(new ActionListener()
            {
                public void actionPerformed(ActionEvent E)
                {
                    tabbedPane.remove(domainTabPanel);
                    domainButton.setEnabled(true);
                    enableDiscription(domainButton);
                }
            });
    	}
    	
    	if(e.getActionCommand().equals("download"))
    	{
    		downloadTabPanel = new JPanel();
    		downloadTabPanel.setLayout(new AbsoluteLayout());
    		tabbedPane.addTab("Download",null,downloadTabPanel,null);
    		tabbedPane.setSelectedComponent(downloadTabPanel);
    		downloadgeneralPanel = new ServerGeneralPanel(ServerGeneralPanel.Images.DOWNLOADRULES);
			rulegui = new DownloadRuleGui(theRules);
			downloadgeneralPanel.add(rulegui, BorderLayout.CENTER);
    		
			//downloadPanel = new DownLoadPanel();
            downloadTabPanel.add(downloadgeneralPanel,new AbsoluteConstraints(2,2,632,510));
    		
    		downloadButton.setEnabled(false);
    		downloadButton.removeMouseListener(this);
    		
    		closeButton = new JButton("Close");
    		downloadTabPanel.add(closeButton,new AbsoluteConstraints(560,525,70,26));
            
            closeButton.addActionListener(new ActionListener()
            {
            	public void actionPerformed(ActionEvent E)
                {
            		tabbedPane.remove(downloadTabPanel);
            		downloadButton.setEnabled(true);
                    enableDiscription(downloadButton);
                }
            });
    	}
    	
    	if(e.getActionCommand().equals("options"))
    	{
    	}
    	
    	if(e.getActionCommand().equals("log"))
    	{
    		logTabPanel = new JPanel();
    		logTabPanel.setLayout(new AbsoluteLayout());
    		tabbedPane.addTab("Log File",null,logTabPanel,null);
    		tabbedPane.setSelectedComponent(logTabPanel);
    		
    		logFilePanel = new LogFilePanel();
            logTabPanel.add(logFilePanel,new AbsoluteConstraints(2,2,632,510));
    		
    		logButton.setEnabled(false);
    		logButton.removeMouseListener(this);
    		
    		closeButton = new JButton("Close");
            logTabPanel.add(closeButton,new AbsoluteConstraints(560,525,70,26));
            
            closeButton.addActionListener(new ActionListener()
            {
            	public void actionPerformed(ActionEvent E)
                {
            		tabbedPane.remove(logTabPanel);
                    logButton.setEnabled(true);
                    enableDiscription(logButton);
                }
            });
    	}
    
    	if(e.getActionCommand().equals("languageFilter"))
    	{
    		//============= Temp=============
    		Vector<String> words = new Vector<String>();
			words.addElement("donder");
			words.addElement("moer");
			Vector<Email> emails = getTestEmails();
			//=================================
			
			languageFilterTabPanel = new JPanel();
    		languageFilterTabPanel.setLayout(new AbsoluteLayout());
    		tabbedPane.addTab("LanguageFilter",null,languageFilterTabPanel,null);
    		tabbedPane.setSelectedComponent(languageFilterTabPanel);
    		generalPanel = new ServerGeneralPanel(ServerGeneralPanel.Images.LANGUAGEFILTER);
    		languageFiltergui = new FilterGui(words,emails);
			generalPanel.add(languageFiltergui, BorderLayout.CENTER);
			languageFilterTabPanel.add(generalPanel,new AbsoluteConstraints(2,2,632,510));
			
    		//logFilePanel = new LogFilePanel();
            //logTabPanel.add(logFilePanel,new AbsoluteConstraints(2,2,632,510));
    		
    		languageFilterButton.setEnabled(false);
    		languageFilterButton.removeMouseListener(this);
    		
    		closeButton = new JButton("Close");
    		languageFilterTabPanel.add(closeButton,new AbsoluteConstraints(560,525,70,26));
            
            closeButton.addActionListener(new ActionListener()
            {
            	public void actionPerformed(ActionEvent E)
                {
            		tabbedPane.remove(languageFilterTabPanel);
            		languageFilterButton.setEnabled(true);
                    enableDiscription(languageFilterButton);
                }
            });
    	}
    
    }

    
    
	public void mouseClicked(MouseEvent me) 
	{
	}

	public void mousePressed(MouseEvent me) 
	{
	}

	public void mouseReleased(MouseEvent me) 
	{
	}

	public void mouseEntered(MouseEvent me) 
	{
		if (me.getComponent() == accountButton)
		{
			infoLabel.setText("<html><font Color=white>Modify and create new accounts</font><html>");
		}
		
		if (me.getComponent() == groupButton)
		{
			infoLabel.setText("<html><font Color=white>Add or remove account groups</font><html>");
		}
		
		if (me.getComponent() == domainButton)
		{
			infoLabel.setText("<html><font Color=white>Manage the domain settings</font><html>");
		}
		
		if (me.getComponent() == downloadButton)
		{
			infoLabel.setText("<html><font Color=white>Choose between different download options</font><html>");
		}
		
		if (me.getComponent() == optionsButton)
		{
			infoLabel.setText("<html><font Color=white>Make changes to the webmail settings</font><html>");
		}
		
		if (me.getComponent() == logButton)
		{
			infoLabel.setText("<html><font Color=white>View the Error Logs file</font><html>");
		}
		if (me.getComponent() == languageFilterButton)
		{
			infoLabel.setText("<html><font Color=white> Open the Language Filter</font><html>");
		}
	}

	public void mouseExited(MouseEvent me) 
	{
		infoLabel.setText("<html><font Color=white>Move mouse over buttons for a <br> discription of their functionality</font></html>");
	}
	
	/*public void setStatus()
	{
		System.out.println("in set Status");
		System.out.println(sss.getPOP3StartStatus());
		System.out.println(sss.getSMTPStartStatus());
		System.out.println(sss.getRMIStartStatus());
		System.out.println(sss.getWebserverStartStatus());
	}*/
	
	
}

⌨️ 快捷键说明

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