Search in sources :

Example 1 with MemoryRealTimeChart

use of com.tencent.wstt.apt.chart.MemoryRealTimeChart in project GT by Tencent.

the class MemoryView 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(viewer.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);
    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();
    memRealTimeChart = new MemoryRealTimeChart();
    contentPane.add(memRealTimeChart);
}
Also used : FormData(org.eclipse.swt.layout.FormData) Panel(java.awt.Panel) Frame(java.awt.Frame) Composite(org.eclipse.swt.widgets.Composite) BorderLayout(java.awt.BorderLayout) JRootPane(javax.swing.JRootPane) FormAttachment(org.eclipse.swt.layout.FormAttachment) MemoryRealTimeChart(com.tencent.wstt.apt.chart.MemoryRealTimeChart)

Aggregations

MemoryRealTimeChart (com.tencent.wstt.apt.chart.MemoryRealTimeChart)1 BorderLayout (java.awt.BorderLayout)1 Frame (java.awt.Frame)1 Panel (java.awt.Panel)1 JRootPane (javax.swing.JRootPane)1 FormAttachment (org.eclipse.swt.layout.FormAttachment)1 FormData (org.eclipse.swt.layout.FormData)1 Composite (org.eclipse.swt.widgets.Composite)1