use of com.tencent.wstt.apt.chart.CPURealTimeChart in project GT by Tencent.
the class CPUView method createChartPanel.
/**
* 初始化jfreechart
* @param rootFrame
*/
private void createChartPanel(Composite parent) {
// 放置图表的容器对象
chartComposite = new Composite(parent, SWT.NO_BACKGROUND | SWT.EMBEDDED);
FormData formData = new FormData();
formData.left = new FormAttachment(0, Constant.VIEW_MARGIN_WIDTH);
formData.right = new FormAttachment(cpuViewer.getTable(), -Constant.VIEW_MARGIN_WIDTH);
formData.top = new FormAttachment(0, Constant.VIEW_MARGIN_WIDTH);
formData.bottom = new FormAttachment(100, -Constant.VIEW_MARGIN_WIDTH);
chartComposite.setLayoutData(formData);
// AWT的根容器
Frame frame = SWT_AWT.new_Frame(chartComposite);
// 据说加入这个Panel可以无闪烁
Panel panel = new Panel(new BorderLayout()) {
private static final long serialVersionUID = 1L;
public void update(java.awt.Graphics g) {
/* Do not erase the background */
paint(g);
}
};
frame.add(panel);
JRootPane root = new JRootPane();
panel.add(root);
java.awt.Container contentPane = root.getContentPane();
cpuRealTimeChart = new CPURealTimeChart();
contentPane.add(cpuRealTimeChart);
}
Aggregations