consolepane.java

来自「时空图计算和编辑程序」· Java 代码 · 共 55 行

JAVA
55
字号
package my_cpt;
import super_cpt.*;
import java.awt.*;
import java.awt.event.*;
public class ConsolePane extends SuperPane implements ActionListener{

	/**
	 * @param args
	 */
	//private IActionExcutor iexcuter=null;
	TextArea txt=new TextArea("-------数据结果输出-------\n");
	public SuperBtn okbtn=new SuperBtn("-------清空-------");
	public ConsolePane()
	{
		super("结果输出面板");
		setLayout(null);
		add(okbtn);
		add(txt);
		txt.setEditable(false);
		txt.setIgnoreRepaint(true);
		txt.setBackground(Color.WHITE);
		okbtn.addActionListener(this);
		Direction=2;
		HidenSide=RIGHT;
	}
	public void actionPerformed(ActionEvent e)
	{//按钮事件处理
		if(e.getSource()==okbtn)
			clear();
	}
	public void showText(final String strtxt)
	{
		txt.append(strtxt);
	}
	public void clear()
	{
		txt.setText("-------数据结果输出-------\n");
	}
	public String getConsole()
	{
		return txt.getText();
	}
	boolean isbool=true;
	public void myPaint(Graphics2D g)
	{
		if(isbool)
		{
			txt.setBounds(5,25,getWidth()-10,getHeight()-50);
			okbtn.setBounds(getWidth()/2-50,txt.getY()+txt.getHeight()+2,96,16);
			isbool=false;
		}
	}

}

⌨️ 快捷键说明

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