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

📄 parapane.java

📁 时空图计算和编辑程序
💻 JAVA
字号:
package my_cpt;
import super_cpt.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import data2.Square;
public class ParaPane extends SuperPane implements ActionListener{

	/**
	 * 颜色面板
	 */
	IActionExcutor iexcuter;
	private Square mySquare=null;
	public SuperBtn okbtn=new SuperBtn("确定");
	private BufferedImage myImage=null;
	public ParaPane()
	{
		super("属性面板");
		setLayout(null);
		setSize(250,140);
		add(okbtn);
		okbtn.setBounds(125-15,140-14-5-4,30,15);
		okbtn.addActionListener(this);
	}
	public void actionPerformed(ActionEvent e)
	{//显示信息
		iexcuter.Confirm(this,RIGHT,true);
	}
	public void setExecutor(IActionExcutor e)
	{//添加执行者
		iexcuter=e;
	}
	public void setMySquare(final Square s)
	{//显示我的指令
		mySquare=s;
		myImage=mySquare.getImage();
		repaint();
	}
	public Square getMySquare(){return mySquare;}
	public void myPaint(Graphics2D g)
	{
		if(mySquare==null)return;
		g.setColor(Color.GREEN);
		g.fillRect(104,22,getWidth()-108,getHeight()-45);
		//绘制图像
		int width=0,height=0,x=0,y=0;
		if(myImage.getWidth()>myImage.getHeight())
		{
			width=100;
			height=myImage.getHeight()*width/myImage.getWidth();
			x=4;y=22+47-height/2;
		}else
		{
			height=94;
			width=myImage.getWidth()*height/myImage.getHeight();
			x=4+50-width/2;
			y=22;
		}
		g.drawImage(myImage,x,y,width,height,this);
		int w=100;
		x=4;y=22;
		////////////////////////////////////
		g.setColor(Color.BLACK);
		g.drawRect(x,y,100,94);
		g.drawString("标号 : "+mySquare.number,x+w+7,y+12);
		g.drawString("坐标 : ("+mySquare.getX()+","+mySquare.getY()+")",x+w+7,y+27);
		g.drawString("尺寸 : ("+mySquare.getWidth()+","+mySquare.getHeight()+")",x+w+7,y+42);
		g.drawString("起始 / 结束 时间 : "+mySquare.getStartX()+" / "+mySquare.getEndX(),x+w+7,y+87);
		g.drawString("前景色 : ",x+w+7,y+57);
		g.setColor(mySquare.forecolor);
		g.fillRect(x+w+75,y+47,12,12);
		g.drawString("背景色 : ",x+w+7,y+72);
		g.setColor(mySquare.backcolor);
		g.fillRect(x+w+75,y+62,12,12);
		
	}
}

⌨️ 快捷键说明

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