📄 graphicalobjectdisplayarea.java
字号:
package toocom.ui;
import java.util.*;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.geom.*;
import java.awt.*;
import java.lang.*;
import toocom.ocgl.*;
/**
* This class represents the graphical panel into which a graph, or an axiom, can be displayed.
*
* @author Fr閐閞ic F黵st
*/
public class GraphicalObjectDisplayArea extends JPanel{
private MainFrame mf;
private InferenceEngineFrame ief;
private NamedGraphicalObject g;
public GraphicalObjectDisplayArea(MainFrame mf,InferenceEngineFrame ief){
this.mf = mf;
this.ief = ief;
this.setBackground(Constants.INFERENCE_ENGINE_FRAME_COLOR);
this.setBorder(new BevelBorder(BevelBorder.LOWERED));
}
public void setGraphicalObject(NamedGraphicalObject g){
this.g = g;
}
public void paint(Graphics gr){
Graphics2D g2d = (Graphics2D) gr;
if(g != null){
AffineTransform at = g2d.getTransform();
double scale = Math.max(g.getBounds(g2d,mf.getOntologyLanguage()).getWidth(),g.getBounds(g2d,mf.getOntologyLanguage()).getHeight());
at.scale(this.getWidth()/scale,this.getHeight()/scale);
at.translate(-1*g.getBounds(g2d,mf.getOntologyLanguage()).getX(),-1*g.getBounds(g2d,mf.getOntologyLanguage()).getY());
g2d.setTransform(at);
g.paintObject(g2d,mf.getOntologyLanguage());
}
else{
g2d.setTransform(new AffineTransform());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -