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

📄 pepaconsole.java

📁 PEPA模型性能分析工具
💻 JAVA
字号:
package gui;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.BoxLayout;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class PepaConsole extends JPanel implements ActionListener{
	
	private String welcome="欢迎使用SPA模型性能分析工具  语言:java  版本:1.0 日期:07.5.4\n";
	private static JTextArea CONSOLE=new JTextArea();
	
	
	public PepaConsole()
	{
        super();
        this.setLayout(new BoxLayout(this,BoxLayout.X_AXIS));
        CONSOLE.setLineWrap(true);
        CONSOLE.setWrapStyleWord(true);
        CONSOLE.setRows(7);
        CONSOLE.setFocusable(false);
        JScrollPane scrollPane=new JScrollPane(CONSOLE);
		this.add(scrollPane,BorderLayout.CENTER);
		
		CONSOLE.append(welcome);
		
		final JPopupMenu edit=new JPopupMenu("Edit");
		edit.setToolTipText("模型编辑面板选项");
		JMenuItem clear=new JMenuItem("清除");
		clear.setToolTipText("清除文本");
		clear.addActionListener(this);
		clear.setActionCommand("Clear");
		edit.add(clear);
		
		CONSOLE.addMouseListener(new MouseAdapter(){
			 public void mouseClicked(MouseEvent e){ check(e);}            //单击
			 public void mouseEntered(MouseEvent e){ check(e);}            //鼠标进入到组件(进入菜单)
			 public void mouseExited(MouseEvent e){ check(e);}              //鼠标离开组件
			 public void mousePressed(MouseEvent e){ check(e);}             // 鼠标在组件上按下
			 public void mouseReleased(MouseEvent e){ check(e);}            //鼠标按钮在组件上释放
			private void check(MouseEvent e)
			{
				if(e.isPopupTrigger())
				{
					edit.show(CONSOLE,e.getX(),e.getY());
				}
			}
		});
	}

	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		String command=e.getActionCommand();
		if(command.equals("Clear"))
		{
			CONSOLE.setText("");
		}
	}
	
	public static void addArgument(String s)
	{
		CONSOLE.append(s);
	}
	
}

⌨️ 快捷键说明

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