forked from 617406160/JavaPlot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlotFrame.java
More file actions
89 lines (75 loc) · 1.65 KB
/
Copy pathPlotFrame.java
File metadata and controls
89 lines (75 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.sin.java.plot;
import java.awt.GraphicsConfiguration;
import java.awt.HeadlessException;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import com.sin.java.plot.model.DrawableObject;
/***
* 绘图窗口,对应matlab的firgue
* @author RobinTang
*
*/
public class PlotFrame extends JFrame {
private static final long serialVersionUID = 1L;
/**
* 构造方法
*/
public PlotFrame() throws HeadlessException {
super();
this.commonInit();
}
public PlotFrame(GraphicsConfiguration gc) {
super(gc);
this.commonInit();
}
public PlotFrame(String title, GraphicsConfiguration gc) {
super(title, gc);
this.commonInit();
}
public PlotFrame(String title) throws HeadlessException {
super(title);
this.commonInit();
}
private PlotPanle plotPanle = null;
// 公共初始化
private void commonInit(){
plotPanle = new PlotPanle();
this.add(plotPanle);
this.setSize(300, 200);
this.setLocationRelativeTo(null);
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
if(!Plot.removePlotFrame(PlotFrame.this)){
System.exit(0);
}
}
});
this.setVisible(true);
}
/**
* 设置绘图保持
*/
public void setHoldOn(boolean holdOn) {
this.plotPanle.setHoldOn(holdOn);
}
/**
* 绘图
*/
public void plot(DrawableObject drawableObject){
this.plotPanle.plot(drawableObject);
}
/**
* 设置显示范围
*/
public void axis(double sx, double ex, double sy, double ey) {
this.plotPanle.axis(sx, ex, sy, ey);
}
/**
* 最佳视野
*/
public void suit(){
this.plotPanle.suit();
}
}