浏览 1874 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2010-06-09
这是一个监控程序 ti = new Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent e) { ArrayList<SensorSimData> list = new ArrayList<SensorSimData>(); for (SensorSimData ss: out.huangcun) { if (ss.sbbh == sbbh && ss.addr == addr) { list.add(ss); } } qxt.refreshMap(list); tqxt.refreshMap(list); rqxt.refreshMap(list); lqxt.refreshMap(list); sxqxt.refreshMap(list); syqxt.refreshMap(list); szqxt.refreshMap(list); list=null; } }); qxt = new QuXianTu_dongtai(out, sbbh, addr); tqxt = new Temp_QuXianTu_dongtai(out, sbbh, addr, gaodixian); rqxt = new Rssi_QuXianTu_dongtai(out, sbbh, addr, gaodixian); lqxt = new Light_QuXianTu_dongtai(out, sbbh, addr, gaodixian); sxqxt = new SpeedX_QuXianTu_dongtai(out, sbbh, addr, gaodixian); syqxt = new SpeedY_QuXianTu_dongtai(out, sbbh, addr, gaodixian); szqxt = new SpeedZ_QuXianTu_dongtai(out, sbbh, addr, gaodixian); jInternalFrame1.setContentPane(qxt.createDemoPanel()); jInternalFrame2.setContentPane(tqxt.createDemoPanel()); jInternalFrame3.setContentPane(rqxt.createDemoPanel()); jInternalFrame4.setContentPane(lqxt.createDemoPanel()); jInternalFrame5.setContentPane(sxqxt.createDemoPanel()); jInternalFrame6.setContentPane(syqxt.createDemoPanel()); jInternalFrame7.setContentPane(szqxt.createDemoPanel()); 这是swing的对话框,在这个对话框中有7个JInternalFrame每一个都画曲线图,通过timer的在动态的画曲线图 这是我其中一个JInternalFrame中曲线图代码: public JPanel createDemoPanel() { JFreeChart chart = createChart(); return new ChartPanel(chart); } void refreshMap(ArrayList<SensorSimData> list){ for (Iterator<SensorSimData> it = list.iterator(); it.hasNext();) { SensorSimData hd = it.next(); if (hd.sbbh == sbbh && hd.addr == addr) { gaoxian.addOrUpdate(new Millisecond(), gaodixian.get(0)); dixian.addOrUpdate(new Millisecond(), gaodixian.get(1)); timeSeries1.addOrUpdate(new Millisecond(hd.date), Double .parseDouble(hd.temp)); } } } 开始的时候还行,很稳定,对话框一点都不卡,可是过了一个小时再看时,程序稳定没出错,但是对话框拖动反应非常慢很卡,不知到各位大侠有没有碰到类似的问题? 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |