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

📄 logfilepanel.java

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

import javax.swing.*;
import org.netbeans.lib.awtextra.AbsoluteConstraints;
import org.netbeans.lib.awtextra.AbsoluteLayout;
import java.awt.*;
import java.io.*;
import za.co.halo.SecureCommunications.ErrorReporting;
import za.co.halo.SecureCommunications.ServerAdmin;
/**
 * @author 
 * LogFilePanel class
 * This class presents the GUI for viewing the log file
 * The ErrorReporting class is referenced to obtain log file information
 */


/**
* 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 LogFilePanel extends javax.swing.JPanel 
{
	private JLabel descriptionLabel;
	private JTextArea logTextArea;
	private JScrollPane scrollPane;
	
   /**
	* 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 LogFilePanel());
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}
	
   /**
	* LogFilePanel constructor
	* Use to:
	* initialize member variables
	* initialize the build of graphical components.
	* @param void
	* @return void 
	*/
	public LogFilePanel()
	{
		super();
		initGUI();
	}
	
   /**
	* initGUI method
	* Use to:
	* initialize graphics
	* @param void
	* @return void 
	*/
	private void initGUI()
	{
		try
		{
			JPanel imagePanel = new ImagePanel("images/log.png","accounts");
			imagePanel.setLayout(null);
			imagePanel.setBounds(0,0,625,83);
			this.add(imagePanel);
			
			this.setLayout(new AbsoluteLayout());
			this.setPreferredSize(new Dimension(630,510));
			
			addWidgets();
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
	
   /**
	* addWidgets method
	* Use to:
	* construct graphics
	* @param void
	* @return void 
	*/
	private void addWidgets()
	{
		descriptionLabel = new JLabel();
		descriptionLabel.setLayout(new AbsoluteLayout());
		//descriptionLabel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Log Report"),BorderFactory.createEmptyBorder(0,0,0,0)));
		this.add(descriptionLabel,new AbsoluteConstraints(2,100,625,405));
		
		logTextArea = new JTextArea();
		logTextArea.setBounds(20,20,10,10);
		logTextArea.setEditable(false);
		logTextArea.setBackground(new Color(21,118,146));
		
		scrollPane = new JScrollPane(logTextArea);
		descriptionLabel.add(scrollPane,new AbsoluteConstraints(0,0,605,375));
		
		displayLogFile();
	}
	
   /**
	* displayLogFile method
	* Use to: 
	* display the content of the log file
	* @param void
	* @return void 
	*/
	private void displayLogFile()
	{
		ErrorReporting report = new ErrorReporting();
		report.setListener(new PanelLogListener());
		BufferedReader reader = null;
		String s = "";
		String test = "";
		//String tempStr = "";
		//String tempStr2 = "";
		try
		{
			reader = new BufferedReader(new FileReader(report.getFile()));
			while (reader.ready())
			{
				test = reader.readLine();
				logTextArea.setForeground(Color.white);
				s += test + "\n";
				logTextArea.setText(s);

			}
			reader.close();
		}
		catch(FileNotFoundException e)
		{
			e.printStackTrace();
		}
		catch(IOException e)
		{
			e.printStackTrace();
		}
		
		//return s;
	}
	
	class PanelLogListener implements LogListener
	{
		PanelLogListener()
		{
			ServerAdmin.error.setListener(this);
		}

		public void addLogString(String s) {
			logTextArea.setText(logTextArea.getText()+s);
		}
		
	}

}

⌨️ 快捷键说明

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